/* ========================================
   MOBILE-SPECIFIC PROFESSIONAL STYLES
   Only applies to mobile devices
   Web styles remain unchanged
   ======================================== */

/* Mobile-only styles - Web unaffected */
@media (max-width: 768px) {

    /* ========================================
       0. GLOBAL RESET & BASE STYLES
       ======================================== */
    * {
        box-sizing: border-box;
    }

    body,
    #app,
    main,
    .page {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    /* ========================================
       1. MODERN MOBILE NAVIGATION
       ======================================== */
    #sidebar-wrapper {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .sidebar-heading {
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(10px);
        padding: 24px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }

    .sidebar-heading span {
        font-size: 1.5rem;
        font-weight: 800;
        letter-spacing: -0.5px;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    /* ========================================
       2. TOUCH-FRIENDLY MENU ITEMS
       ======================================== */
    .list-group-item {
        min-height: 56px !important;
        padding: 16px 20px !important;
        margin: 6px 12px !important;
        border-radius: 14px !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        display: flex !important;
        align-items: center !important;
        gap: 16px !important;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .list-group-item i {
        font-size: 1.5rem !important;
        width: 28px !important;
        height: 28px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .list-group-item:active {
        background: rgba(255, 255, 255, 0.25) !important;
        transform: scale(0.98) !important;
    }

    .list-group-item.active {
        background: rgba(255, 255, 255, 0.2) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    }

    /* Sub-menu items */
    .sub-link {
        min-height: 48px !important;
        padding: 12px 16px 12px 48px !important;
        font-size: 0.95rem !important;
        margin: 4px 12px !important;
    }

    /* ========================================
       3. MODERN HEADER BAR (Includes Avatar & Dark Mode)
       ======================================== */
    .navbar {
        padding: 12px 16px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
        /* Default Light Mode Background */
        background: #ffffff !important;
    }

    .navbar .btn {
        min-width: 44px !important;
        min-height: 44px !important;
        border-radius: 12px !important;
        padding: 10px !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    }

    .navbar .btn:active {
        transform: scale(0.95) !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12) !important;
    }

    .avatar-circle {
        width: 40px !important;
        height: 40px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
        border-radius: 50% !important;
        /* Ensure visibility */
        background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        color: white !important;
    }

    /* ========================================
       4. PROFESSIONAL BUTTONS
       ======================================== */
    .btn {
        min-height: 52px !important;
        padding: 14px 24px !important;
        border-radius: 14px !important;
        font-size: 1rem !important;
        font-weight: 700 !important;
        letter-spacing: 0.3px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        transition: all 0.2s ease !important;
    }

    .btn:active {
        transform: scale(0.96) !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
    }

    .btn-primary {
        background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    }

    .btn-success {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    }

    .btn-danger {
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    }

    .btn-warning {
        background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    }

    .btn-sm {
        min-height: 44px !important;
        padding: 10px 18px !important;
        font-size: 0.9rem !important;
    }

    .btn-lg {
        min-height: 60px !important;
        padding: 18px 32px !important;
        font-size: 1.1rem !important;
    }

    /* Icon buttons */
    .btn i {
        font-size: 1.25rem !important;
    }

    .btn-sm i {
        font-size: 1.1rem !important;
    }

    /* ========================================
       5. MODERN CARDS & CONTAINERS
       ======================================== */
    .card {
        border-radius: 20px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
        margin-bottom: 20px !important;
        overflow: hidden !important;
        background: #ffffff;
        /* Default light bg */
    }

    .card-header {
        padding: 20px !important;
        background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
        border-bottom: 2px solid #e2e8f0 !important;
    }

    .card-header h4,
    .card-header h5 {
        font-size: 1.25rem !important;
        font-weight: 800 !important;
        margin: 0 !important;
        color: #0f172a;
        /* Default light text */
    }

    .card-body {
        padding: 20px !important;
    }

    /* ========================================
       6. FORM ELEMENTS
       ======================================== */
    .form-control,
    .form-select {
        min-height: 52px !important;
        padding: 14px 18px !important;
        border-radius: 12px !important;
        font-size: 1rem !important;
        border: 2px solid #e2e8f0 !important;
        transition: all 0.2s ease !important;
        background-color: #ffffff;
        color: #0f172a;
    }

    .form-control:focus,
    .form-select:focus {
        border-color: #6366f1 !important;
        box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1) !important;
    }

    .form-label {
        font-size: 0.95rem !important;
        font-weight: 700 !important;
        color: #475569 !important;
        margin-bottom: 8px !important;
    }

    /* ========================================
       7. BADGES & TAGS
       ======================================== */
    .badge {
        padding: 8px 14px !important;
        border-radius: 10px !important;
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        letter-spacing: 0.3px !important;
    }


    /* ========================================
       8. MOBILE CARD VIEW (Table Replacement via CSS)
       ======================================== */
    .table-responsive {
        display: block !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .mobile-card-view {
        display: none !important;
    }

    .mobile-card {
        background: white;
        border-radius: 16px;
        padding: 20px;
        margin-bottom: 16px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        border: 1px solid #f1f5f9;
        transition: all 0.2s ease;
    }

    .mobile-card:active {
        transform: scale(0.98);
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
    }

    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;
        padding-bottom: 16px;
        border-bottom: 2px solid #f1f5f9;
    }

    .mobile-card-title {
        font-size: 1.15rem;
        font-weight: 800;
        color: #0f172a;
    }

    .mobile-card-id {
        font-size: 0.85rem;
        font-weight: 700;
        color: #64748b;
        background: #f1f5f9;
        padding: 6px 12px;
        border-radius: 8px;
    }

    .mobile-card-body {
        display: grid;
        gap: 12px;
    }

    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
    }

    .mobile-card-label {
        color: #64748b;
        font-size: 0.9rem;
        font-weight: 600;
    }

    .mobile-card-value {
        color: #0f172a;
        font-weight: 700;
        font-size: 1rem;
        text-align: right;
    }

    .mobile-card-actions {
        display: flex;
        gap: 10px;
        margin-top: 16px;
        padding-top: 16px;
        border-top: 2px solid #f1f5f9;
    }

    .mobile-card-actions .btn {
        flex: 1;
        min-height: 48px;
    }

    /* ========================================
       9. FLOATING ACTION BUTTON (FAB)
       ======================================== */
    .fab {
        position: fixed;
        bottom: 24px;
        right: 24px;
        width: 64px;
        height: 64px;
        border-radius: 50%;
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        color: white;
        border: none;
        box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1000;
        transition: all 0.3s ease;
    }

    .fab:active {
        transform: scale(0.9);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.5);
    }

    .fab i {
        font-size: 1.75rem;
    }

    /* ========================================
       10. MODERN ICONS
       ======================================== */
    i.bi {
        line-height: 1;
    }

    /* Icon sizes */
    .icon-sm {
        font-size: 1.25rem !important;
    }

    .icon-md {
        font-size: 1.5rem !important;
    }

    .icon-lg {
        font-size: 2rem !important;
    }

    /* ========================================
       11. SPACING & TYPOGRAPHY
       ======================================== */
    main {
        padding: 16px !important;
        background: #f8fafc !important;
        min-height: 100vh;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        font-weight: 800 !important;
        letter-spacing: -0.5px !important;
        color: #0f172a;
    }

    h4 {
        font-size: 1.35rem !important;
    }

    h5 {
        font-size: 1.15rem !important;
    }

    /* ========================================
       12. ANIMATIONS
       ======================================== */
    @keyframes slideInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .animate-in {
        animation: slideInUp 0.3s ease;
    }

    /* ========================================
       13. BOTTOM SHEET / MODAL
       ======================================== */
    .modal-content {
        border-radius: 24px 24px 0 0 !important;
        border: none !important;
    }

    .modal-header {
        padding: 24px !important;
        border-bottom: 2px solid #f1f5f9 !important;
    }

    .modal-body {
        padding: 24px !important;
    }

    .modal-footer {
        padding: 20px 24px !important;
        border-top: 2px solid #f1f5f9 !important;
    }

    /* ========================================
       14. LOADING STATES
       ======================================== */
    .spinner-border,
    .spinner-grow {
        width: 48px !important;
        height: 48px !important;
        border-width: 4px !important;
    }

    /* ========================================
       15. ALERTS & TOASTS
       ======================================== */
    .alert {
        border-radius: 14px !important;
        padding: 18px 20px !important;
        font-weight: 600 !important;
        border: none !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    }

    .alert i {
        font-size: 1.25rem !important;
        margin-right: 10px !important;
    }

    /* Mobile Typography & Overflow Fixes */
    .display-6,
    .display-5,
    .display-4,
    .display-1,
    h1,
    h2,
    h3 {
        font-size: calc(1.3rem + 0.5vw) !important;
        max-width: 100%;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    /* Dark Mode Overrides for General Mobile Elements */
    [data-theme="dark"] body,
    [data-theme="dark"] main,
    [data-theme="dark"] .page {
        background: #0f172a !important;
        color: #f1f5f9 !important;
    }

    [data-theme="dark"] .navbar {
        background: #1e293b !important;
        border-bottom-color: #334155 !important;
    }

    [data-theme="dark"] .navbar .btn,
    [data-theme="dark"] .btn-light {
        background: #334155 !important;
        border-color: #475569 !important;
        color: #f1f5f9 !important;
    }

    [data-theme="dark"] .card,
    [data-theme="dark"] .mobile-card {
        background: #1e293b !important;
        border-color: #334155 !important;
    }

    [data-theme="dark"] .card-header,
    [data-theme="dark"] .mobile-card-header {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
        border-bottom-color: #334155 !important;
    }

    [data-theme="dark"] h1,
    [data-theme="dark"] h2,
    [data-theme="dark"] h3,
    [data-theme="dark"] h4,
    [data-theme="dark"] h5,
    [data-theme="dark"] h6,
    [data-theme="dark"] .text-dark,
    [data-theme="dark"] .mobile-card-title,
    [data-theme="dark"] .mobile-card-value {
        color: #f1f5f9 !important;
    }

    [data-theme="dark"] .text-muted,
    [data-theme="dark"] .text-secondary,
    [data-theme="dark"] .mobile-card-label {
        color: #94a3b8 !important;
    }

    [data-theme="dark"] .mobile-card-id {
        background: #334155 !important;
        color: #cbd5e1 !important;
    }

    [data-theme="dark"] .mobile-card-actions {
        border-top-color: #334155 !important;
    }

    [data-theme="dark"] .form-control,
    [data-theme="dark"] .form-select {
        background-color: #1e293b !important;
        border-color: #334155 !important;
        color: #f1f5f9 !important;
    }

    [data-theme="dark"] .form-label {
        color: #cbd5e1 !important;
    }
}

/* ========================================
   BOTTOM NAVIGATION BAR (Mobile Only)
   ======================================== */
@media (max-width: 768px) {
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 1050;
        padding-bottom: env(safe-area-inset-bottom);
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #94a3b8;
        text-decoration: none;
        font-size: 0.75rem;
        font-weight: 600;
        width: 100%;
        height: 100%;
        transition: all 0.2s ease;
    }

    .bottom-nav-item i {
        font-size: 1.5rem;
        margin-bottom: 4px;
        transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .bottom-nav-item.active {
        color: #6366f1;
    }

    .bottom-nav-item.active i {
        transform: translateY(-4px);
        background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        filter: drop-shadow(0 4px 6px rgba(99, 102, 241, 0.3));
    }

    /* Add padding to main content */
    main {
        padding-bottom: 90px !important;
    }

    /* Dark Mode */
    [data-theme="dark"] .bottom-nav {
        background: rgba(30, 41, 59, 0.95);
        border-top-color: rgba(255, 255, 255, 0.05);
    }

    [data-theme="dark"] .bottom-nav-item {
        color: #64748b;
    }

    [data-theme="dark"] .bottom-nav-item.active {
        color: #818cf8;
    }
}

/* ========================================
   DESKTOP STYLES
   ======================================== */
@media (min-width: 769px) {
    .bottom-nav {
        display: none !important;
    }

    .mobile-card-view {
        display: none !important;
    }
}

/* ========================================
   GLOBAL COMPONENT OVERRIDES
   ======================================== */
.avatar-circle {
    width: 40px !important;
    height: 40px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
}