@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');
@import './animations.css';

/* ========== LIGHT THEME (DEFAULT) ========== */
:root {
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-hover: rgba(255, 255, 255, 0.95);

    /* Text Colors */
    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-inverse: #ffffff;

    /* Brand Colors */
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #60A5FA;
    --secondary: #06B6D4;
    --secondary-dark: #0891B2;

    /* Status Colors */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* UI Elements */
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #2563EB 0%, #38BDF8 100%);
    --gradient-secondary: linear-gradient(135deg, #3B82F6 0%, #06B6D4 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);

    /* Other */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Mobile Design Standards */
    --btn-primary-height: 52px;
    --btn-secondary-height: 44px;
    --btn-icon-size: 44px;
    --btn-radius: 12px;
    --card-radius: 16px;
    --text-title: 24px;
    --text-section: 18px;
    --text-body: 15px;
    --text-small: 13px;
}


/* ========== DARK THEME ========== */
[data-theme="dark"] {
    /* Backgrounds */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --surface: rgba(30, 41, 59, 0.9);
    --surface-hover: rgba(30, 41, 59, 0.95);

    /* Text Colors */
    --text-main: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;

    /* Brand Colors - Brighter for dark mode */
    --primary: #60A5FA;
    --primary-dark: #3B82F6;
    --primary-light: #93C5FD;
    --secondary: #22D3EE;
    --secondary-dark: #06B6D4;

    /* Status Colors - Adjusted for dark mode */
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --info: #60a5fa;

    /* UI Elements */
    --border: #334155;
    --border-hover: #475569;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);

    /* Gradients - More vibrant for dark mode */
    --gradient-primary: linear-gradient(135deg, #3B82F6 0%, #67E8F9 100%);
    --gradient-secondary: linear-gradient(135deg, #60A5FA 0%, #22D3EE 100%);
    --gradient-success: linear-gradient(135deg, #34d399 0%, #10b981 100%);
}

/* ========== BASE STYLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========== LAYOUT ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

header {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    margin-top: 4rem;
}


main {
    min-height: calc(100vh - 200px);
    padding: 0;
}

/* ========== CARDS ========== */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

/* ========== BUTTONS ========== */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background: var(--gradient-secondary);
    color: white !important;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* FIXED: Outline buttons now have solid background for better visibility */
.btn-outline {
    background: var(--bg-secondary);
    border: 2px solid var(--primary);
    color: var(--primary) !important;
}

.btn-outline:hover {
    background: var(--primary);
    color: white !important;
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-main);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
}

/* ========== REMOVE CIRCLE COMPONENT ========== */
.wb-remove-circle {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 10;
    width: 24px;
    height: 24px;
    background: var(--primary, #2563eb);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.wb-remove-circle:hover {
    background: var(--primary-dark, #1d4ed8);
}

/* ========== SPACING UTILITIES ========== */
.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

/* ========== FORMS ========== */
.input-group {
    margin-bottom: 1rem;
}

.input-field,
.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.input-field:focus,
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--bg-primary);
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
}

/* ========== DISABLE NUMBER INPUT SPINNERS GLOBALLY ========== */
/* Hide spin buttons on number inputs - users type instead of scroll */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ========== MODALS ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

/* ========== STATUS BADGES ========== */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: rgba(37, 99, 235, 0.2);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.status-confirmed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.status-cancelled,
.status-rejected {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.status-completed {
    background: rgba(245, 158, 11, 0.2);
    color: #F59E0B;
    border: 1px solid #F59E0B;
}

/* ========== THEME TOGGLE ========== */
.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
}

/* ========== CRITICAL MOBILE RESPONSIVENESS ========== */
/* Hamburger menu styling */
.ag-hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.ag-hamburger span {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--text-main);
    border-radius: 2px;
    transition: 0.3s;
}

/* Mobile: Hide desktop nav, show hamburger */
@media (max-width: 768px) {

    /* ============================================
       STANDARDIZED MOBILE BUTTON HEIGHTS
       All buttons match "View More Details" button 
       ============================================ */

    /* Core button classes */
    .btn,
    button.btn,
    a.btn,

    /* Theme-specific button classes (cloud kitchen, restaurant themes) */
    .cc-btn,
    .fb-btn,
    .ue-btn,
    .gk-btn,
    .hc-btn,
    .fd-btn,

    /* Hospital theme buttons */
    .ch-btn,
    .th-btn,
    .fh-btn,
    .eh-btn,
    .hosp-btn,

    /* Gym, spa, salon theme buttons */
    .eo-btn,
    .pc-btn,
    .mm-btn,
    .te-btn,
    .ng-btn,
    .ts-btn,

    /* Visual editor buttons */
    .ve-btn,

    /* Form submit buttons */
    button[type="submit"],
    input[type="submit"],
    input[type="button"],

    /* Generic styled buttons in modals and forms */
    .modal-overlay button,
    .card button,
    form button,

    /* Quick action buttons */
    .quick-actions-grid button,
    .quick-actions-grid a {
        padding-top: 0.6rem !important;
        padding-bottom: 0.6rem !important;
    }

    .hide-mobile,
    .ag-hide-mobile {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        pointer-events: none !important;
    }

    .hide-mobile *,
    .ag-hide-mobile * {
        display: none !important;
    }

    .ag-hamburger {
        display: flex !important;
    }

    /* ========== GLOBAL MOBILE BUTTON STANDARD ========== */
    /* All buttons standardized to 36px height on mobile - covers ALL pages */
    /* EXCLUDES remove/close buttons which need to stay circular */
    .btn,
    .btn-primary,
    .btn-outline,
    .btn-secondary,
    button.btn,
    a.btn,

    /* Login/Register page buttons */
    .login-btn,
    .register-btn,
    .step-actions .btn,

    /* Chat/BizAI buttons */
    .chat-send-btn,
    .bizai-btn,

    /* Landing page buttons */
    .hero-btn,
    .cta-btn,

    /* Form buttons - EXCLUDE remove buttons */
    button[type="submit"],
    button[type="button"]:not([class*="remove"]):not([id*="remove"]):not([class*="gallery"]):not([class*="close"]) {
        height: 36px !important;
        min-height: 36px !important;
        max-height: 36px !important;
        font-size: 13px !important;
        padding: 0 16px !important;
        border-radius: 10px !important;
    }

    /* Preserve circular image-overlay remove buttons ONLY */
    /* These are the X buttons on image thumbnails, NOT text "Remove" buttons */
    .remove-gallery-btn,
    .remove-product-image,
    .remove-facility-image,
    #remove-mfg-about-image,
    button[style*="border-radius: 50%"] {
        border-radius: 50% !important;
        width: 24px !important;
        height: 24px !important;
        min-height: 24px !important;
        max-height: 24px !important;
        min-width: 24px !important;
        max-width: 24px !important;
        padding: 0 !important;
        font-size: 12px !important;
    }

    /* ========== DASHBOARD MOBILE STANDARDIZATION ========== */

    /* Action row - spread buttons across full width */
    .dashboard-action-row {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }

    /* Header icon buttons - ALL 4 buttons spread evenly */
    .header-icon-btn,
    .dashboard-header .header-icon-btn {
        flex: 1 !important;
        height: 44px !important;
        min-height: 44px !important;
        max-height: 44px !important;
        padding: 0 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 10px !important;
        font-size: 18px !important;
    }

    /* Icon buttons (not status toggle) - gray background */
    .header-icon-btn:not(#status-toggle) {
        border: 2px solid var(--border) !important;
        background: var(--bg-secondary) !important;
    }

    /* Status toggle - keep its dynamic styling, just size it */
    #status-toggle.header-icon-btn {
        font-size: 11px !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        /* Background/color set dynamically by JS */
    }

    /* Account button wrapper */
    .dashboard-action-row>div[style*="position: relative"] {
        flex: 1 !important;
        display: flex !important;
    }

    .dashboard-action-row>div[style*="position: relative"] .header-icon-btn {
        width: 100% !important;
    }

    /* Primary action buttons - other contexts */
    .btn-primary-action:not(.header-icon-btn) {
        height: var(--btn-primary-height) !important;
        min-height: var(--btn-primary-height) !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        border-radius: var(--btn-radius) !important;
    }

    /* Website Builder CTA card - compact for mobile */
    .card[style*="linear-gradient"] {
        padding: 14px !important;
    }

    .card[style*="linear-gradient"] h2 {
        font-size: 15px !important;
        font-weight: 600 !important;
        line-height: 20px !important;
        margin-bottom: 8px !important;
    }

    .card[style*="linear-gradient"] .btn-primary {
        height: 36px !important;
        min-height: 36px !important;
        font-size: 13px !important;
        padding: 0 1rem !important;
    }

    .card[style*="linear-gradient"]>div {
        gap: 8px !important;
    }

    /* Website Link card - compact for mobile */
    .website-url-box,
    div[style*="font-family: monospace"] {
        padding: 8px 10px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
    }

    /* Website Link card buttons - smaller */
    .website-link-actions .btn {
        height: 36px !important;
        min-height: 36px !important;
        font-size: 13px !important;
    }

    /* Action button row - proper gaps */
    .dashboard-action-row,
    .dashboard-header>div:last-child {
        gap: 8px !important;
    }

    /* Cards - compact padding on mobile */
    .card {
        border-radius: var(--card-radius) !important;
        padding: 14px !important;
    }

    /* Title typography */
    .dashboard-header h1 {
        font-size: var(--text-title) !important;
        font-weight: 700 !important;
    }

    /* Subtitle - optional removal or muted */
    .dashboard-header p[style*="text-muted"] {
        font-size: 14px !important;
        opacity: 0.6 !important;
    }

    /* Remove duplicate status button styling in icon row */
    .dashboard-header .status-btn-duplicate {
        display: none !important;
    }

    /* ========================= */
    /* BizAI Chat Input - Mobile */
    /* ========================= */

    /* Chat input container */
    .chat-wrapper>div:last-child {
        padding: 8px 10px !important;
        gap: 8px !important;
    }

    /* Chat input text field */
    #chat-input {
        min-height: 40px !important;
        height: 40px !important;
        padding: 0.5rem 0.75rem !important;
        font-size: 14px !important;
        border-radius: 8px !important;
    }

    /* Chat send button */
    #send-btn {
        min-width: 44px !important;
        width: 44px !important;
        min-height: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        border-radius: 8px !important;
    }

    #send-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
}

/* Desktop: Show nav, hide hamburger */
@media (min-width: 769px) {

    .hide-desktop,
    .ag-hide-desktop {
        display: none !important;
    }

    .ag-hamburger {
        display: none !important;
    }

    .hide-mobile {
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
    }
}

/* ========== CHAT INPUT STYLES ========== */
.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
}

.chat-input-field {
    flex: 1;
    padding: 1rem;
    min-height: 50px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-main);
}

.chat-input-field:focus {
    border-color: var(--primary);
    outline: none;
}

.chat-send-btn {
    padding: 0 1.5rem;
    min-width: 60px;
    min-height: 50px;
    border-radius: var(--radius-md);
}

@media (max-width: 480px) {
    .chat-input-container {
        padding: 0.75rem;
        gap: 8px;
    }

    .chat-input-field {
        padding: 0.875rem;
        font-size: 16px;
        /* Prevent iOS zoom */
    }

    .chat-send-btn {
        padding: 0 1rem;
        min-width: 50px;
    }
}

/* ========== WEBSITE BUILDER ADMIN MOBILE RESPONSIVE ========== */
/* Fix form grids on mobile - collapse to single column */
@media (max-width: 768px) {

    /* Two-column grids collapse to single column */
    .gym-row-2col,
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr"] {
        display: block !important;
    }

    .gym-row-2col>div,
    div[style*="grid-template-columns: 1fr 1fr"]>div,
    div[style*="grid-template-columns:1fr 1fr"]>div {
        margin-bottom: 1rem;
    }

    /* Menu inputs grid - 3 columns to single column */
    .menu-inputs-grid {
        display: block !important;
    }

    .menu-inputs-grid>*,
    .menu-inputs-grid>input,
    .menu-inputs-grid>textarea,
    .menu-inputs-grid>select,
    .menu-inputs-grid>div {
        width: 100% !important;
        margin-bottom: 0.75rem;
    }

    /* Treatment, therapist, package item cards - prevent overflow */
    .treatment-item-card,
    .therapist-item-card,
    .package-item-card {
        padding: 1rem !important;
        overflow: hidden;
    }

    /* Ensure inputs within cards don't overflow */
    .treatment-item-card input,
    .treatment-item-card textarea,
    .treatment-item-card select,
    .therapist-item-card input,
    .therapist-item-card textarea,
    .therapist-item-card select,
    .package-item-card input,
    .package-item-card textarea,
    .package-item-card select {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* File input fix - don't let it cause overflow */
    input[type="file"] {
        max-width: 100% !important;
        font-size: 0.85rem;
    }

    /* Photo upload row - stack vertically on mobile */
    div[style*="display: flex"][style*="align-items: center"][style*="flex-wrap: wrap"] {
        flex-direction: column;
        align-items: flex-start !important;
    }

    /* Cards prevent horizontal overflow */
    .card {
        padding: 1rem !important;
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    /* Prevent any element from overflowing the card */
    .card * {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Delete button should be full width on mobile (except gallery image delete and items manager) */
    button[class*="delete-"]:not(.delete-gallery-img):not(.im-delete-btn),
    .delete-treatment,
    .delete-therapist,
    .delete-package {
        width: 100% !important;
    }

    /* Hide in-app back buttons on mobile — phone's native back button handles navigation */
    .mobile-hide-back {
        display: none !important;
    }
}