/**
 * Modern Design System for Zwarah
 * Preserves original colors while adding modern UI/UX patterns
 */

/* ============================================
   🎨 Color Palette (Preserved)
   ============================================ */
:root {
    /* Primary Colors */
    --bg-primary: #0f172a;        /* Dark blue background */
    --bg-secondary: #1e293b;      /* Slate card background */
    --bg-tertiary: #334155;       /* Lighter slate */
    
    /* Accent Colors */
    --accent-gold: #facc15;       /* Primary gold/yellow */
    --accent-orange: #f59e0b;     /* Secondary orange/gold */
    --accent-blue: #3b82f6;       /* Blue accent */
    --accent-green: #22c55e;      /* Success green */
    --accent-red: #ef4444;        /* Error red */
    
    /* Text Colors */
    --text-primary: #ffffff;      /* White text */
    --text-secondary: #94a3b8;    /* Gray text */
    --text-muted: #64748b;        /* Muted gray */
    
    /* Gradients */
    --gradient-gold: linear-gradient(135deg, #f59e0b, #facc15);
    --gradient-blue: linear-gradient(135deg, #3b82f6, #0ea5e9);
    --gradient-dark: linear-gradient(135deg, #0f172a, #1e293b);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-gold: 0 4px 20px rgba(250, 204, 21, 0.3);
    --shadow-glow: 0 0 20px rgba(250, 204, 21, 0.5);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ============================================
   🌐 Global Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Modern Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: var(--spacing-sm);
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-gold);
}

/* ============================================
   🎴 Modern Card Components
   ============================================ */
.modern-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.modern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-gold);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.modern-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.modern-card:hover::before {
    opacity: 1;
}

/* Glassmorphism Card */
.glass-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
}

/* Gradient Card */
.gradient-card {
    background: var(--gradient-dark);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    position: relative;
    overflow: hidden;
}

.gradient-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(250, 204, 21, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

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

/* ============================================
   🔘 Modern Buttons
   ============================================ */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.btn-modern::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-modern:hover::before {
    width: 300px;
    height: 300px;
}

.btn-modern:active {
    transform: scale(0.98);
}

/* Button Variants */
.btn-gold {
    background: var(--gradient-gold);
    color: var(--bg-primary);
    box-shadow: var(--shadow-gold);
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(250, 204, 21, 0.4);
}

.btn-blue {
    background: var(--gradient-blue);
    color: white;
}

.btn-blue:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--accent-gold);
    color: var(--accent-gold);
}

.btn-outline:hover {
    background: var(--accent-gold);
    color: var(--bg-primary);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-gold);
}

/* Button Sizes */
.btn-lg {
    padding: 1.125rem 2.25rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

/* ============================================
   📝 Modern Form Elements
   ============================================ */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    color: var(--accent-gold);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Tajawal', sans-serif;
    transition: all var(--transition-base);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.1);
}

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

.form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    transition: all var(--transition-base);
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.1);
}

/* ============================================
   🎯 Modern Navigation
   ============================================ */
.navbar-modern {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--accent-gold);
    padding: var(--spacing-md) var(--spacing-lg);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all var(--transition-base);
}

.navbar-modern.scrolled {
    box-shadow: var(--shadow-md);
}

.navbar-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--spacing-lg);
    position: relative;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-gold);
    text-decoration: none;
    grid-column: 1;
    z-index: 1;
}

.navbar-brand img {
    width: 45px;
    height: 45px;
    border-radius: var(--radius-sm);
}

.navbar-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    grid-column: 2;
}

.navbar-user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    grid-column: 3;
    justify-content: flex-end;
}

.navbar-auth-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Mobile Menu Toggle - Hidden on Desktop */
.navbar-menu-toggle {
    display: none;
}

/* Mobile Menu - Hidden on Desktop */
.navbar-mobile-overlay,
.navbar-mobile-menu {
    display: none;
}

.navbar-link {
    color: var(--text-primary);
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.navbar-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-gold);
    transition: all var(--transition-base);
    transform: translateX(-50%);
}

.navbar-link:hover {
    color: var(--accent-gold);
}

.navbar-link:hover::after {
    width: 80%;
}

/* ============================================
   ✨ Animations & Effects
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(250, 204, 21, 0.8);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-in {
    animation: slideInRight 0.6s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-glow {
    animation: glow 2s infinite;
}

/* ============================================
   📱 Responsive Design
   ============================================ */

/* Mobile Portrait (default) */
@media (max-width: 768px) {
    :root {
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.25rem; }
    
    .navbar-content {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        grid-template-columns: none;
    }
    
    .navbar-user-info {
        display: none;
    }
    
    .navbar-links {
        display: none;
    }
    
    /* Mobile Menu Toggle Button */
    .navbar-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 30px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
    }
    
    .navbar-menu-toggle span {
        width: 100%;
        height: 3px;
        background: var(--accent-gold);
        border-radius: 3px;
        transition: all 0.3s ease;
    }
    
    .navbar-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }
    
    .navbar-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .navbar-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(8px, -8px);
    }
    
    /* Mobile Menu Overlay */
    .navbar-mobile-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }
    
    .navbar-mobile-overlay.active {
        opacity: 1;
        pointer-events: all;
    }
    
    /* Mobile Menu */
    .navbar-mobile-menu {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        background: rgba(30, 41, 59, 0.98);
        backdrop-filter: blur(20px);
        border-left: 2px solid rgba(250, 204, 21, 0.3);
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
        overflow-y: auto;
    }
    
    .navbar-mobile-menu.active {
        transform: translateX(0);
    }
    
    .navbar-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid rgba(250, 204, 21, 0.2);
    }
    
    .navbar-mobile-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        color: var(--accent-gold);
        font-size: 1.25rem;
        font-weight: 700;
        text-decoration: none;
    }
    
    .navbar-mobile-brand img {
        width: 40px;
        height: 40px;
    }
    
    .navbar-mobile-close {
        background: transparent;
        border: none;
        color: var(--accent-gold);
        font-size: 2rem;
        cursor: pointer;
        padding: 5px 10px;
        line-height: 1;
    }
    
    .navbar-mobile-links {
        padding: 20px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .navbar-mobile-link {
        display: block;
        padding: 15px;
        color: var(--text-primary);
        text-decoration: none;
        border-radius: var(--radius-md);
        background: rgba(250, 204, 21, 0.1);
        border: 1px solid rgba(250, 204, 21, 0.2);
        transition: all 0.3s ease;
        font-size: 1.1rem;
    }
    
    .navbar-mobile-link:hover {
        background: rgba(250, 204, 21, 0.2);
        transform: translateX(-5px);
    }
    
    .navbar-mobile-link-primary {
        background: rgba(59, 130, 246, 0.2);
        border-color: rgba(59, 130, 246, 0.3);
    }
    
    .navbar-mobile-link-gold {
        background: rgba(250, 204, 21, 0.3);
        border-color: rgba(250, 204, 21, 0.4);
        color: var(--accent-gold);
        font-weight: 600;
    }
    
    .navbar-mobile-link-logout {
        background: rgba(239, 68, 68, 0.2);
        border-color: rgba(239, 68, 68, 0.3);
        color: var(--accent-red);
        margin-top: 10px;
    }
    
    .navbar-mobile-credits {
        padding: 15px;
        text-align: center;
        background: rgba(250, 204, 21, 0.15);
        border-radius: var(--radius-md);
        margin: 10px 0;
    }
    
    /* Hide desktop links on mobile */
    .navbar-links {
        display: none;
    }
    
    .modern-card {
        padding: var(--spacing-md);
    }
}

/* Mobile Landscape */
@media (orientation: landscape) and (max-width: 1024px) and (max-height: 600px) {
    :root {
        --spacing-md: 1rem;
        --spacing-lg: 1.25rem;
        --spacing-xl: 1.5rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .modern-card {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .btn-modern {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
}

/* Small Mobile Portrait */
@media (max-width: 480px) {
    :root {
        --spacing-sm: 0.75rem;
        --spacing-md: 1rem;
        --spacing-lg: 1.25rem;
        --spacing-xl: 1.5rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.125rem; }
    
    .modern-card {
        padding: var(--spacing-sm);
    }
    
    .btn-modern {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
}

/* Small Mobile Landscape */
@media (orientation: landscape) and (max-width: 900px) and (max-height: 500px) {
    :root {
        --spacing-xs: 0.25rem;
        --spacing-sm: 0.5rem;
        --spacing-md: 0.75rem;
        --spacing-lg: 1rem;
        --spacing-xl: 1.25rem;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1rem; }
    
    .btn-modern {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
}

/* ============================================
   🎨 Utility Classes
   ============================================ */
.text-gold { color: var(--accent-gold); }
.text-orange { color: var(--accent-orange); }
.text-blue { color: var(--accent-blue); }
.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-muted { color: var(--text-muted); }

.bg-gradient-gold { background: var(--gradient-gold); }
.bg-gradient-blue { background: var(--gradient-blue); }
.bg-gradient-dark { background: var(--gradient-dark); }

.shadow-gold { box-shadow: var(--shadow-gold); }
.shadow-glow { box-shadow: var(--shadow-glow); }

.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Grid System */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(1, 1fr); }
}

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Spacing Utilities */
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }

/* Text Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

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

/* ============================================
   🎭 Flash Messages (Modern)
   ============================================ */
.flash-modern {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: slideDown 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.flash-modern::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
}

.flash-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.flash-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.flash-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
