/* ==========================================
   MODERN THEME - Clean & Professional Design
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ==========================================
   CSS CUSTOM PROPERTIES (Variables)
   ========================================== */
:root {
    /* Modern Color Palette */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-card: rgba(26, 26, 36, 0.8);
    --bg-card-hover: rgba(32, 32, 44, 0.9);
    
    /* Primary Colors */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);
    
    /* Accent Colors */
    --accent-cyan: #22d3ee;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-violet: #8b5cf6;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --text-accent: #818cf8;
    
    /* Gradients */
    --gradient-bg: linear-gradient(180deg, #0a0a0f 0%, #12121a 50%, #1a1a24 100%);
    --gradient-card: linear-gradient(135deg, rgba(26, 26, 36, 0.9) 0%, rgba(18, 18, 26, 0.95) 100%);
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-cyan: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-primary: 0 4px 20px rgba(99, 102, 241, 0.3);
    --shadow-success: 0 4px 20px rgba(16, 185, 129, 0.3);
    
    /* Border */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.12);
    --border-primary: rgba(99, 102, 241, 0.3);
    
    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
}

/* ==========================================
   BASE STYLES
   ========================================== */
* {
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    visibility: visible;
    opacity: 1;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gradient-bg);
    color: var(--text-primary);
    overscroll-behavior: none;
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    position: relative;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Page Title */
.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ==========================================
   BACKGROUND
   ========================================== */
.modern-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float-orb 20s ease-in-out infinite;
}

.bg-gradient-orb.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.bg-gradient-orb.orb-2 {
    width: 300px;
    height: 300px;
    background: var(--accent-violet);
    bottom: 20%;
    left: -80px;
    animation-delay: 5s;
}

.bg-gradient-orb.orb-3 {
    width: 250px;
    height: 250px;
    background: var(--accent-cyan);
    bottom: -50px;
    right: 20%;
    animation-delay: 10s;
    opacity: 0.2;
}

@keyframes float-orb {
    0%, 100% { 
        transform: translate(0, 0) scale(1); 
    }
    33% { 
        transform: translate(20px, -30px) scale(1.05); 
    }
    66% { 
        transform: translate(-15px, 20px) scale(0.95); 
    }
}

/* Subtle grid pattern */
.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.5;
}

/* ==========================================
   CARDS & CONTAINERS
   ========================================== */
.glass-card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.glass-card:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-md);
}

.glass-card.glow-primary {
    border-color: var(--border-primary);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.15);
}

.glass-card.glow-success {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(16, 185, 129, 0.15);
}

.glass-card.glow-cyan {
    border-color: rgba(34, 211, 238, 0.3);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(34, 211, 238, 0.15);
}

/* Card with animated border */
.card-glow-border {
    position: relative;
}

.card-glow-border::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(135deg, var(--primary), var(--accent-violet), var(--accent-cyan));
    border-radius: calc(var(--radius-lg) + 1px);
    z-index: -1;
    opacity: 0.4;
    animation: border-glow 4s ease-in-out infinite;
}

@keyframes border-glow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    padding: 12px 24px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-primary);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: scale(0.96) translateY(1px);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--primary-light);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-secondary:active {
    background: rgba(99, 102, 241, 0.2);
    transform: scale(0.96);
}

.btn-ghost {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    color: var(--accent-emerald);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-ghost:active {
    background: rgba(16, 185, 129, 0.2);
    transform: scale(0.96);
}

/* Icon Button */
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    transition: all 0.2s;
    cursor: pointer;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-icon:active {
    transform: scale(0.9);
}

/* ==========================================
   INPUT FIELDS
   ========================================== */
.input-field {
    background: rgba(18, 18, 26, 0.8);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    padding: 14px 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.input-field:focus {
    background: rgba(26, 26, 36, 0.9);
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), 0 0 20px rgba(99, 102, 241, 0.1);
}

.input-field::placeholder {
    color: var(--text-muted);
}

/* ==========================================
   PILLS & BADGES
   ========================================== */
.pill {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pill.selected {
    background: var(--gradient-primary);
    border-color: transparent;
    box-shadow: var(--shadow-primary);
}

.pill.selected span,
.pill.selected .pill-icon {
    color: #ffffff !important;
}

.pill:active {
    transform: scale(0.95);
}

.pill-icon {
    width: 18px;
    height: 18px;
    color: var(--primary-light);
}

.username-badge {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--primary-light);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
    transition: all 0.2s;
    cursor: pointer;
    display: inline-block;
}

.username-badge:active {
    transform: scale(0.96);
    background: rgba(99, 102, 241, 0.2);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-amber);
}

.badge-error {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
}

/* ==========================================
   ICON BADGES
   ========================================== */
.icon-badge {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.icon-badge svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

.icon-badge.generator { 
    background: var(--gradient-primary);
}

.icon-badge.checker { 
    background: var(--gradient-success);
}

.icon-badge.history { 
    background: var(--gradient-cyan);
}

.icon-badge.profile { 
    background: linear-gradient(135deg, var(--accent-violet) 0%, var(--accent-rose) 100%);
}

.icon-badge:active {
    transform: scale(0.9);
}

/* ==========================================
   TAB BAR
   ========================================== */
.tab-bar {
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.tab-btn {
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    cursor: pointer;
}

.tab-btn svg {
    width: 24px;
    height: 24px;
    transition: all 0.3s;
}

.tab-btn span {
    font-size: 11px;
    font-weight: 500;
}

.tab-btn.active {
    color: var(--primary-light);
}

.tab-btn.active svg {
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.tab-btn:active {
    transform: scale(0.9);
}

/* ==========================================
   STATUS INDICATORS
   ========================================== */
.status-available {
    color: var(--accent-emerald);
}

.status-taken {
    color: var(--accent-rose);
}

/* ==========================================
   SECTION HEADERS
   ========================================== */
.section-header {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 20px 20px 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header svg {
    width: 16px;
    height: 16px;
    color: var(--primary-light);
}

/* ==========================================
   DIVIDERS
   ========================================== */
.divider,
.ios-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-light), transparent);
}

/* ==========================================
   DROPDOWN MENU
   ========================================== */
.dropdown-menu {
    display: none;
    background: var(--gradient-card);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    animation: dropFade 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dropdown.active .dropdown-menu {
    display: block;
}

/* ==========================================
   PAGE ANIMATIONS
   ========================================== */
.page {
    display: none;
    animation: fadeSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 10;
}

.page.active {
    display: block;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-appear {
    animation: cardPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes dropFade {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ==========================================
   SPECIAL EFFECTS
   ========================================== */

/* Pulse animation for loading */
.pulse-icon {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Spin animation */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Glow text */
.glow-text {
    text-shadow: 0 0 20px currentColor;
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* ==========================================
   MODAL STYLES
   ========================================== */
.modal-backdrop {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--gradient-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    box-shadow: 0 0 60px rgba(99, 102, 241, 0.15);
}

/* ==========================================
   INSET GROUPED (iOS Style Lists)
   ========================================== */
.inset-grouped {
    margin: 0 16px;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
}

.inset-grouped-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s ease;
    cursor: pointer;
}

.inset-grouped-item:last-child {
    border-bottom: none;
}

.inset-grouped-item:active {
    background: rgba(99, 102, 241, 0.1);
}

/* Chevron */
.chevron {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.chevron svg {
    width: 100%;
    height: 100%;
}

/* ==========================================
   AVATAR
   ========================================== */
.avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-primary);
}

.avatar svg {
    width: 28px;
    height: 28px;
    color: #ffffff;
}

/* ==========================================
   STAT CARDS
   ========================================== */
.stat-card {
    background: rgba(26, 26, 36, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.stat-card .stat-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 8px;
    color: var(--primary-light);
}

.stat-card .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================
   CALENDAR GRID (Daily Rewards)
   ========================================== */
.calendar-day {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    background: rgba(26, 26, 36, 0.6);
    border: 1px solid var(--border-subtle);
    transition: all 0.2s;
}

.calendar-day.claimed {
    background: var(--gradient-success);
    border-color: transparent;
    color: #ffffff;
}

.calendar-day.today {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--primary-light); }
.text-success { color: var(--accent-emerald); }
.text-warning { color: var(--accent-amber); }
.text-error { color: var(--accent-rose); }
.text-cyan { color: var(--accent-cyan); }

.bg-primary { background: var(--gradient-primary); }
.bg-success { background: var(--gradient-success); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ==========================================
   LOADING SPINNER
   ========================================== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-desc {
    font-size: 14px;
    color: var(--text-muted);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 380px) {
    .page-title {
        font-size: 24px;
    }
    
    .icon-badge {
        width: 42px;
        height: 42px;
    }
    
    .icon-badge svg {
        width: 20px;
        height: 20px;
    }
}
