/* ============================================
   MOBILE APP THEME - UNIVERSAL APP-LIKE UI
   ============================================ */

/* ============================================
   ROOT VARIABLES - APP THEME
   ============================================ */
:root {
    /* App Color Palette - Premium Glass Theme */
    --app-primary: #6366F1;
    --app-primary-dark: #4F46E5;
    --app-primary-light: #818CF8;
    --app-secondary: #10B981;
    --app-accent: #F472B6;
    --app-warning: #F59E0B;
    --app-danger: #EF4444;
    --app-success: #10B981;
    --app-info: #3B82F6;

    /* Glass Surfaces */
    --app-bg: linear-gradient(135deg, #DFE9F3 0%, #FFFFFF 100%);
    /* Fallback */
    --app-bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --app-surface: rgba(255, 255, 255, 0.7);
    --app-surface-variant: rgba(255, 255, 255, 0.4);
    --app-overlay: rgba(0, 0, 0, 0.5);
    --app-glass-border: 1px solid rgba(255, 255, 255, 0.3);

    /* Text Colors */
    --app-text-primary: #1F2937;
    --app-text-secondary: #4B5563;
    --app-text-disabled: #9CA3AF;
    --app-text-on-primary: #FFFFFF;

    /* Shadows */
    --app-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --app-shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --app-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --app-shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);

    /* Radius */
    --app-radius-sm: 8px;
    --app-radius-md: 12px;
    --app-radius-lg: 20px;
    --app-radius-xl: 30px;
    --app-radius-full: 9999px;

    /* Spacing */
    --app-space-xs: 4px;
    --app-space-sm: 8px;
    --app-space-md: 16px;
    --app-space-lg: 24px;
    --app-space-xl: 32px;
    --app-space-2xl: 48px;

    /* Header Heights */
    --app-header-height: 60px;
    --app-bottom-nav-height: 80px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark)) !important;
    color: white !important;
}

.bg-gradient-success {
    background: linear-gradient(135deg, var(--app-secondary), #059669) !important;
    color: white !important;
}

.bg-gradient-danger {
    background: linear-gradient(135deg, #FF6B6B, #EE5253) !important;
    color: white !important;
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #FDCB6E, #F8B500) !important;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.glass-panel {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.text-white {
    color: white !important;
}

.mb-3 {
    margin-bottom: var(--app-space-md) !important;
}

/* ============================================
   BASE STYLES - GLASSMOPHISM FOUNDATION
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--app-bg-gradient);
    background-attachment: fixed;
    color: var(--app-text-primary);
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* ============================================
   APP LAYOUT STRUCTURE
   ============================================ */
.app-container {
    min-height: 100vh;
    padding-bottom: var(--app-bottom-nav-height);
    background: var(--app-bg);
}

.app-content {
    padding: var(--app-space-md);
    padding-top: calc(var(--app-header-height) + var(--app-space-md));
    max-width: 100%;
    margin: 0 auto;
}

/* Desktop max-width */
@media (min-width: 768px) {
    .app-content {
        max-width: 1200px;
        padding: var(--app-space-lg);
        padding-top: calc(var(--app-header-height) + var(--app-space-lg));
    }
}

/* ============================================
   APP HEADER (TOP BAR)
   ============================================ */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--app-header-height);
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--app-space-md);
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.app-header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--app-text-primary);
    display: flex;
    align-items: center;
    gap: var(--app-space-sm);
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: var(--app-space-sm);
}

.app-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--app-radius-full);
    background: var(--app-surface-variant);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--app-text-primary);
    font-size: 1.1rem;
}

.app-icon-btn:active {
    transform: scale(0.9);
}

.app-icon-btn:hover {
    background: var(--app-primary-light);
    color: var(--app-primary);
}

/* ============================================
   APP CARDS
   ============================================ */
.app-card {
    background: var(--app-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--app-glass-border);
    border-radius: var(--app-radius-lg);
    padding: var(--app-space-lg);
    box-shadow: var(--app-shadow-sm);
    margin-bottom: var(--app-space-md);
    transition: all 0.3s ease;
}

.app-card:hover {
    box-shadow: var(--app-shadow-md);
    transform: translateY(-2px);
}

.app-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--app-space-md);
    padding-bottom: var(--app-space-md);
    border-bottom: 1px solid var(--app-surface-variant);
}

.app-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--app-text-primary);
    display: flex;
    align-items: center;
    gap: var(--app-space-sm);
}

.app-card-body {
    color: var(--app-text-secondary);
}

/* ============================================
   APP STATS CARDS
   ============================================ */
.app-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--app-space-md);
    margin-bottom: var(--app-space-lg);
}

.app-stat-card {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark));
    border-radius: var(--app-radius-lg);
    padding: var(--app-space-lg);
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: var(--app-shadow-md);
    transition: all 0.3s ease;
}

.app-stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    transition: all 0.6s ease;
}

.app-stat-card:active {
    transform: scale(0.98);
}

.app-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--app-radius-md);
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: var(--app-space-md);
}

.app-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: var(--app-space-xs);
    line-height: 1;
}

.app-stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 500;
}

/* Color Variants */
.app-stat-card.success {
    background: linear-gradient(135deg, #00B894, #00A380);
}

.app-stat-card.warning {
    background: linear-gradient(135deg, #FDCB6E, #F8B500);
}

.app-stat-card.danger {
    background: linear-gradient(135deg, #FF7675, #E84393);
}

.app-stat-card.info {
    background: linear-gradient(135deg, #74B9FF, #0984E3);
}

/* ============================================
   APP LIST ITEMS
   ============================================ */
.app-list {
    background: var(--app-surface);
    border-radius: var(--app-radius-lg);
    overflow: hidden;
    margin-bottom: var(--app-space-md);
}

.app-list-item {
    display: flex;
    align-items: center;
    padding: var(--app-space-md);
    border-bottom: 1px solid var(--app-surface-variant);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: var(--app-text-primary);
}

.app-list-item:last-child {
    border-bottom: none;
}

.app-list-item:active {
    background: var(--app-surface-variant);
}

.app-list-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--app-radius-md);
    background: var(--app-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--app-primary);
    font-size: 1.25rem;
    margin-right: var(--app-space-md);
    flex-shrink: 0;
}

.app-list-content {
    flex: 1;
}

.app-list-title {
    font-weight: 600;
    margin-bottom: var(--app-space-xs);
    color: var(--app-text-primary);
}

.app-list-subtitle {
    font-size: 0.875rem;
    color: var(--app-text-secondary);
}

.app-list-action {
    color: var(--app-text-disabled);
    font-size: 1.25rem;
}

/* ============================================
   APP BUTTONS
   ============================================ */
.app-btn {
    padding: 14px 24px;
    border-radius: var(--app-radius-full);
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--app-space-sm);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.app-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.6s, height 0.6s, top 0.6s, left 0.6s;
}

.app-btn:active::before {
    width: 300px;
    height: 300px;
    top: calc(50% - 150px);
    left: calc(50% - 150px);
}

.app-btn-primary {
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark));
    color: white;
    box-shadow: var(--app-shadow-md);
}

.app-btn-primary:active {
    transform: scale(0.98);
}

.app-btn-secondary {
    background: var(--app-surface-variant);
    color: var(--app-text-primary);
}

.app-btn-outline {
    background: transparent;
    border: 2px solid var(--app-primary);
    color: var(--app-primary);
}

.app-btn-lg {
    padding: 18px 32px;
    font-size: 1.125rem;
    width: 100%;
}

.app-btn-sm {
    padding: 10px 16px;
    font-size: 0.875rem;
}

/* ============================================
   APP BADGES
   ============================================ */
.app-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--app-space-xs);
    padding: 6px 12px;
    border-radius: var(--app-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.app-badge-success {
    background: #D4EDDA;
    color: #155724;
}

.app-badge-warning {
    background: #FFF3CD;
    color: #856404;
}

.app-badge-danger {
    background: #F8D7DA;
    color: #721C24;
}

.app-badge-info {
    background: #D1ECF1;
    color: #0C5460;
}

.app-badge-primary {
    background: var(--app-primary-light);
    color: var(--app-primary-dark);
}

/* ============================================
   APP INPUT FIELDS
   ============================================ */
.app-input-group {
    margin-bottom: var(--app-space-lg);
}

.app-input-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--app-space-sm);
    color: var(--app-text-primary);
    font-size: 0.875rem;
}

.app-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--app-surface-variant);
    border-radius: var(--app-radius-md);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--app-surface);
    color: var(--app-text-primary);
}

.app-input:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

.app-input::placeholder {
    color: var(--app-text-disabled);
}

/* Input with Icon */
.app-input-with-icon {
    position: relative;
}

.app-input-with-icon .app-input {
    padding-left: 48px;
}

.app-input-with-icon .app-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--app-text-secondary);
    font-size: 1.25rem;
}

/* ============================================
   APP BOTTOM SHEET
   ============================================ */
.app-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--app-surface);
    border-radius: var(--app-radius-xl) var(--app-radius-xl) 0 0;
    padding: var(--app-space-lg);
    box-shadow: var(--app-shadow-xl);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 10001;
    max-height: 80vh;
    overflow-y: auto;
}

.app-bottom-sheet.active {
    transform: translateY(0);
}

.app-bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--app-surface-variant);
    border-radius: var(--app-radius-full);
    margin: 0 auto var(--app-space-lg);
}

/* ============================================
   APP FLOATING ACTION BUTTON
   ============================================ */
.app-fab {
    position: fixed;
    bottom: calc(var(--app-bottom-nav-height) + var(--app-space-lg));
    right: var(--app-space-lg);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark));
    color: white;
    border: none;
    box-shadow: var(--app-shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
}

.app-fab:active {
    transform: scale(0.9);
}

/* ============================================
   APP ANIMATIONS
   ============================================ */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-slide-up {
    animation: slideInUp 0.4s ease;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease;
}

.animate-scale-in {
    animation: scaleIn 0.4s ease;
}

/* ============================================
   APP DIVIDER
   ============================================ */
.app-divider {
    height: 1px;
    background: var(--app-surface-variant);
    margin: var(--app-space-lg) 0;
}

.app-divider-text {
    display: flex;
    align-items: center;
    gap: var(--app-space-md);
    margin: var(--app-space-lg) 0;
    color: var(--app-text-secondary);
    font-size: 0.875rem;
}

.app-divider-text::before,
.app-divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--app-surface-variant);
}

/* ============================================
   APP EMPTY STATE
   ============================================ */
.app-empty-state {
    text-align: center;
    padding: var(--app-space-2xl) var(--app-space-lg);
}

.app-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--app-space-lg);
    border-radius: 50%;
    background: var(--app-surface-variant);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--app-text-disabled);
}

.app-empty-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--app-space-sm);
    color: var(--app-text-primary);
}

.app-empty-message {
    color: var(--app-text-secondary);
    margin-bottom: var(--app-space-lg);
}

/* ============================================
   APP LOADING
   ============================================ */
.app-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   APP PULL TO REFRESH INDICATOR
   ============================================ */
.app-pull-refresh {
    position: absolute;
    top: var(--app-header-height);
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 999;
}

.app-pull-refresh.active {
    transform: translateX(-50%) scale(1);
}

/* ============================================
   APP SWIPEABLE ITEM
   ============================================ */
.app-swipeable {
    position: relative;
    overflow: hidden;
}

.app-swipeable-actions {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: var(--app-space-sm);
    padding: 0 var(--app-space-md);
}

.app-swipe-action {
    width: 48px;
    height: 48px;
    border-radius: var(--app-radius-md);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.app-swipe-action.delete {
    background: var(--app-danger);
    color: white;
}

.app-swipe-action.edit {
    background: var(--app-info);
    color: white;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .app-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .app-stat-card {
        padding: var(--app-space-md);
    }

    .app-stat-value {
        font-size: 1.5rem;
    }
}

/* ============================================
   APP SAFE AREA (for notched devices)
   ============================================ */
@supports (padding-top: env(safe-area-inset-top)) {
    .app-header {
        padding-top: env(safe-area-inset-top);
        height: calc(var(--app-header-height) + env(safe-area-inset-top));
    }

    .app-content {
        padding-top: calc(var(--app-header-height) + env(safe-area-inset-top) + var(--app-space-md));
    }

    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--app-bottom-nav-height) + env(safe-area-inset-bottom));
    }
}

/* ============================================
   OVERRIDE EXISTING STYLES FOR APP THEME
   ============================================ */
.main-content {
    padding: 0 !important;
    margin: 0 !important;
    padding-bottom: calc(var(--app-bottom-nav-height) + var(--app-space-md)) !important;
    background: var(--app-bg) !important;
}

.container {
    padding: var(--app-space-md) !important;
    max-width: 100% !important;
}

/* Hide desktop navbar on mobile */
@media (max-width: 1024px) {
    .desktop-navbar {
        display: none !important;
    }

    .mobile-header {
        display: none !important;
    }

    /* Hide footer on mobile devices */
    .footer {
        display: none !important;
    }
}

/* Show footer only on desktop */
@media (min-width: 1025px) {
    .footer {
        display: block;
    }
}