/* FIXED MOBILE STYLES FOR CONFIRMIA */

@media (max-width: 1024px) {

    /* Layout */
    .dashboard-layout {
        flex-direction: column !important;
        overflow-x: hidden;
    }

    /* Fixed Sidebar for Mobile */
    .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px !important;
        height: 100vh !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 9999 !important;
        background: white !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2) !important;
    }

    .sidebar.active {
        transform: translateX(0) !important;
    }

    /* Main Content Reset */
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 60px !important;
        /* Space for fixed topbar */
    }

    /* Fixed Topbar */
    .top-bar {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: white !important;
        z-index: 1000 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 15px !important;
        border-bottom: 1px solid #eee !important;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    }

    .mobile-menu-btn {
        display: block !important;
        font-size: 24px !important;
        border: none !important;
        background: none !important;
        padding: 5px !important;
        cursor: pointer;
    }

    /* Content Area */
    .view-container,
    .content-area,
    .dashboard-view {
        padding: 15px !important;
    }

    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
        margin-bottom: 20px !important;
    }

    .page-header h1 {
        font-size: 1.5rem !important;
    }

    /* Grids */
    .calendars-grid,
    .stats-grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    /* Cards */
    .calendar-card,
    .config-card,
    .stat-card {
        padding: 15px !important;
        width: 100% !important;
    }

    /* Table Transformation to Cards */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block !important;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        background: white;
        border: 1px solid #eee;
        border-radius: 12px;
        margin-bottom: 15px;
        padding: 10px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    }

    td {
        border: none !important;
        position: relative;
        padding-left: 45% !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
        text-align: right !important;
        min-height: 40px;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
    }

    td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 40%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 700;
        color: #666;
        font-size: 12px;
        text-transform: uppercase;
    }

    /* Whatsapp Preview Fix */
    .whatsapp-preview-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    /* General Form Elements */
    .btn {
        width: 100% !important;
        padding: 12px !important;
        justify-content: center !important;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
        /* Avoid zoom on iOS */
    }

    /* Overlay for Sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 9998;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block !important;
    }

    /* Top Bar Mobile */
    .top-bar {
        padding: 0 10px !important;
        gap: 10px !important;
    }

    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        font-size: 20px !important;
        color: #333;
        border-radius: 8px;
        flex-shrink: 0;
        background: none;
        border: none;
    }

    .search-bar {
        flex: 1;
        margin: 0 !important;
        max-width: none !important;
    }

    /* Modal Button Fix (Prevention of cut-off) */
    .connected-card {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
        padding: 12px !important;
        height: auto !important;
    }

    .connected-card>div:first-child {
        width: 100%;
    }

    #btnDisconnectWA {
        width: 100% !important;
        justify-content: center !important;
        margin-top: 5px;
        white-space: nowrap;
    }

    /* Modal dialog adjustment */
    .modal-dialog {
        width: 95% !important;
        margin: 20px auto !important;
    }
}

/* Hide mobile button on desktop */
@media (min-width: 1025px) {
    .mobile-menu-btn {
        display: none !important;
    }
}