/* Prevent Mobile Menu Flash */
.mobile-menu:not(.open) {
    display: none !important;
    transform: translateX(100%);
}
/* TFB PORTAL MASTER STYLES 
  Principal: High-contrast, premium spacing, and mobile-first fluid design.
*/

/* 1. ROOT DEFAULTS - Ensures clean fonts and smooth scrolling */
html, body {
    height: 100%;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    background-color: #f8fafc; /* Slate 50 */
}

/* 2. LAYOUT CONTAINERS - Fixes the "hitting the edge" issue on mobile */
.tfb-main-container {
    max-width: 72rem; /* max-w-6xl */
    margin-left: auto;
    margin-right: auto;
    padding: 2rem 1.25rem; /* 1.25rem (px-5) ensures cards don't touch screen edges on mobile */
}

@media (min-width: 768px) {
    .tfb-main-container {
        padding: 4rem 2rem;
    }
}

/* 3. CARDS & TABLES - The "Rounded Glass" look */
.tfb-card {
    background-color: white;
    border-radius: 2rem; /* rounded-[2rem] */
    border: 1px solid #f1f5f9; /* border-slate-100 */
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    overflow: hidden; /* Keeps the internal rows inside the rounded corners */
}

/* 4. MOBILE SCROLL FIX - Wraps tables to allow horizontal swipe without breaking layout */
.tfb-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* 5. BUTTONS - Unified Action Principal */
.btn-primary {
    background-color: #020617; /* Slate 950 */
    color: white;
    padding: 1rem 2rem;
    border-radius: 1rem;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    background-color: #1e293b; /* Slate 800 */
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* 6. INPUTS & SELECTS - Large touch targets for mobile */
.tfb-input {
    width: 100%;
    padding: 1.25rem;
    background-color: #f8fafc;
    border: 2px solid transparent;
    border-radius: 1.25rem;
    font-size: 0.875rem; /* text-sm */
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
}

.tfb-input:focus {
    border-color: #22c55e; /* Green 500 */
    background-color: white;
}

/* 7. STATUS BADGES */
.badge {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    border: 1px solid transparent;
}

.badge-paid { background-color: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.badge-unpaid { background-color: white; color: #94a3b8; border-color: #e2e8f0; }

/* 8. MODAL FIXES - Ensures modals are scrollable on short mobile screens */
.tfb-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(2, 6, 23, 0.4);
    backdrop-filter: blur(8px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.tfb-modal-content {
    background-color: white;
    width: 100%;
    max-width: 42rem;
    max-height: 90vh;
    border-radius: 2.5rem;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}
.badge {
    white-space: nowrap; /* This stops the text from ever breaking into two lines */
    display: inline-flex; /* Ensures the pill stays as one solid unit */
    align-items: center;
    justify-content: center;
}
/* Responsive Calendar Container */
@media (max-width: 640px) {
    .fc { 
        padding: 0.75rem !important; 
        border-radius: 1.5rem !important; 
    }
    
    /* Shrink the massive Month/Year title */
    .fc-toolbar-title { 
        font-size: 1.25rem !important; 
        margin-bottom: 0.5rem;
    }

    /* Make day headers (Sun, Mon) smaller */
    .fc-col-header-cell-cushion {
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    /* Stack the toolbar so buttons don't overflow */
    .fc-header-toolbar {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 0.5rem !important;
}

/* Tightens buttons so they don't overflow the screen */
.fc .fc-button {
    padding: 0.5rem 0.7rem !important;
    margin-left: 2px !important;
}

.fc-button-group {
    display: flex !important;
    gap: 2px;
}
  .tfb-modal-content {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

/* Makes the facility address stand out on small screens */
#detail-address {
    font-size: 1.25rem;
}

    /* Shrink the event pills so they fit in the boxes */
    .fc-event {
        padding: 2px 4px !important;
        font-size: 9px !important;
    }
}

/* Custom Button Styling to match TFB Black */
.fc-button-primary {
    background: #020617 !important;
    border: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
}

.fc-button-active {
    background: #2563eb !important; /* Blue for the active view */
}

.btn-success {
    background-color: #22c55e; /* TFB Action Green */
    color: white;
    padding: 1rem 2rem;
    border-radius: 1rem;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.2);
}

.btn-success:hover {
    background-color: #16a34a;
    transform: translateY(-1px);
}



/* --- TFB BUILDER MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
    /* Change 'body' to 'body.builder-page' or simply use a more specific target */
    body:has(.sidebar) {
        display: flex !important;
        flex-direction: column !important;
        overflow-x: hidden;
    }

    /* 2. Transform Sidebar into a scrollable Top Bar */
    .sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        border-right: none !important;
        border-bottom: 1px solid #f1f5f9;
        padding: 20px !important;
    }

    /* 3. Make the page list a horizontal scroll or compact grid */
    #page-list {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .page-item {
        flex: 0 0 140px; /* Fixed width items for horizontal swiping */
        padding: 10px !important;
        text-align: center;
    }

    /* 4. Reset Editor Area for small screens */
    .editor-area {
        padding: 20px !important;
        width: 100% !important;
        height: auto !important; /* Let it grow naturally */
        overflow-y: visible !important; /* Let the body handle scroll */
    }

    /* 5. Adjust the Header/Buttons for tight spaces */
    .editor-area .flex.justify-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
        margin-bottom: 30px !important;
    }

    .editor-area .flex.gap-3 {
        width: 100%;
        display: grid;
        grid-template-cols: 1fr; /* Stack buttons on top of each other */
        gap: 10px;
    }

    /* 6. Advanced Form Tweak: Stack columns */
    .grid-cols-2, .md\:grid-cols-3 {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }

    /* 7. Hide the "Back to Portal" text to save space, or move it */
    .sidebar a[href="/dashboard.html"] {
        margin-top: 15px;
        display: block;
        background: #f8fafc;
        padding: 10px;
        border-radius: 8px;
    }
}

/* --- TFB Badge Fix --- */
.badge, 
#leads-tbody span {
    white-space: nowrap !important;
    display: inline-block;
}

/* --- EASY BUILDER MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
    body:has(.main-content) {
        display: block !important;
        overflow-x: hidden;
    }

    /* 2. Transform Sidebar to Top Navigation */
    .sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        border-right: none !important;
        border-bottom: 2px solid #f1f5f9;
        padding: 20px !important;
        z-index: 100;
    }

    /* 3. Make Library Swipeable Horizontally */
    #library-list {
        display: flex !important;
        flex-direction: row !important;
        gap: 12px;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .library-item {
        flex: 0 0 160px; /* Force items to sit in a horizontal row */
        padding: 12px !important;
        margin-bottom: 0 !important;
    }

    /* 4. Optimize Main Canvas Area */
    .main-content {
        padding: 20px !important;
        background: #f8fafc;
        width: 100% !important;
    }

    /* 5. Compact Section Cards */
    .block-card {
        padding: 15px !important;
        gap: 12px !important;
        border-radius: 20px !important;
    }

    .block-card p {
        max-width: 150px !important; /* Prevent text from pushing card width */
    }

    /* 6. Fix Button Layout in Sidebar */
    #builder-controls {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding-top: 15px !important;
    }

    #builder-controls button, 
    #builder-controls a {
        margin: 0 !important;
        padding: 12px !important;
        font-size: 9px !important;
    }
    
    /* Move Exit Portal to full width below buttons */
    #builder-controls a {
        grid-column: span 2;
    }
}
