/**
 * CLAUDIA Dashboard - Mobile Floating Header
 * Creates a card-style floating header on mobile devices
 * Version: 2.1 - Aligned containers at X:12px
 */

/* =============================================
   MOBILE FLOATING HEADER
   ============================================= */

@media (max-width: 768px) {
    /* Floating header style - CRITICAL */
    header.main-header {
        left: 12px !important;
        right: 12px !important;
        margin: 0 !important;
        width: calc(100% - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
        position: fixed !important;
        top: 12px !important;
        z-index: 1000 !important;
        background: rgb(30, 41, 59) !important;
        padding: 12px 16px !important;
        padding-top: max(12px, env(safe-area-inset-top)) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    /* Logo section adjustments */
    header.main-header .logo-section {
        gap: 8px !important;
        flex: 0 0 auto !important;
    }

    header.main-header .logo h1 {
        font-size: 1.1rem !important;
    }

    header.main-header .logo img {
        width: 28px !important;
        height: 28px !important;
    }

    /* Hide nav links on mobile */
    header.main-header .nav-links {
        display: none !important;
    }

    /* Hide header actions on mobile */
    header.main-header .header-actions {
        display: none !important;
    }

    /* Mobile menu toggle visible */
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 40px !important;
        height: 40px !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border: none !important;
        border-radius: 8px !important;
        color: white !important;
        font-size: 20px !important;
        cursor: pointer !important;
        transition: background 0.2s ease !important;
    }

    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:active {
        background: rgba(255, 255, 255, 0.2) !important;
    }

    /* Summary section adjustment for floating header */
    #summary {
        margin-top: 0 !important;
    }

    /* =============================================
       DASHBOARD TOOLBAR - FLOATING CARD STYLE
       ============================================= */
    .dashboard-toolbar {
        margin: 80px 0 12px 0 !important;
        padding: 16px !important;
        background: rgb(30, 41, 59) !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
        border: none !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .dashboard-toolbar .search-input {
        width: 100% !important;
        order: 1 !important;
        margin: 0 !important;
        background: rgba(15, 23, 42, 0.8) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 8px !important;
        padding: 12px 16px !important;
        color: white !important;
        font-size: 14px !important;
    }

    .dashboard-toolbar .search-input::placeholder {
        color: rgba(255, 255, 255, 0.5) !important;
    }

    .dashboard-toolbar .btn {
        order: 2 !important;
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 120px !important;
        justify-content: center !important;
        padding: 10px 16px !important;
    }

    .dashboard-toolbar .last-update {
        order: 3 !important;
        width: 100% !important;
        text-align: center !important;
        font-size: 11px !important;
        color: rgba(148, 163, 184, 0.8) !important;
        margin-top: 4px !important;
    }

    /* =============================================
       CONTAINER ALIGNMENT FIX - All at X:12px
       ============================================= */
    
    /* Dashboard container */
    .dashboard {
        padding: 0 12px 12px 12px !important;
    }

    /* Content grid - remove lateral padding */
    .content-grid {
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 84px !important;
    }

    /* =============================================
       GENERAL PAGE CONTENT
       ============================================= */
    
    /* Container padding for pages without toolbar */
    .container,
    .page-content,
    .main-content {
        padding-top: 80px !important;
    }

    /* Page header sections */
    .page-header {
        margin: 0 0 12px 0 !important;
        border-radius: 12px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    }

    /* Config/Form cards floating style */
    .config-section,
    .settings-card,
    .form-card {
        margin: 0 0 12px 0 !important;
        border-radius: 12px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }
}

/* =============================================
   DESKTOP - RESET TO EDGE-TO-EDGE
   ============================================= */

@media (min-width: 769px) {
    header.main-header {
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        top: 0 !important;
    }

    .mobile-menu-toggle {
        display: none !important;
    }
}
