/* ============================================
   Premium UI System - Glassmorphism 2.0
   Includes Dark Mode, Advanced Effects, Animations
   ============================================ */

/* ===== CSS Variables for Theming ===== */
:root {
    /* Light Mode (default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.1);
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    
    /* Accent Colors */
    --accent-primary: #2563eb;
    --accent-secondary: #7c3aed;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-mesh: 
        radial-gradient(at 40% 20%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(6, 182, 212, 0.1) 0px, transparent 50%),
        radial-gradient(at 80% 80%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
}

/* ===== Dark Mode Theme ===== */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.4);
    
    /* Dark Glassmorphism */
    --glass-bg: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    
    /* Dark gradient mesh */
    --gradient-mesh: 
        radial-gradient(at 40% 20%, rgba(59, 130, 246, 0.2) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(139, 92, 246, 0.2) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(6, 182, 212, 0.15) 0px, transparent 50%);
}

[data-theme="dark"] body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.9);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .nav-link {
    color: var(--text-secondary);
}

[data-theme="dark"] section {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

[data-theme="dark"] .footer {
    background: var(--bg-primary);
}

/* ===== Glassmorphism Cards ===== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 
        var(--glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 20px 50px var(--shadow-color),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ===== Gradient Mesh Background ===== */
.gradient-mesh-bg {
    background: var(--gradient-mesh);
    background-color: var(--bg-primary);
}

/* ===== Premium Buttons ===== */
.btn-premium {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

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

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

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.5);
}

.btn-premium:active {
    transform: translateY(0);
}

/* Ripple effect container */
.btn-premium .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-effect 0.6s ease-out;
    pointer-events: none;
}

@keyframes ripple-effect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===== 3D Tilt Cards ===== */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.tilt-card:hover {
    transform: perspective(1000px) rotateX(var(--rotateX, 0deg)) rotateY(var(--rotateY, 0deg));
}

.tilt-card .card-content {
    transform: translateZ(30px);
}

/* ===== Skeleton Loading ===== */
.skeleton {
    background: linear-gradient(90deg, 
        var(--bg-tertiary) 25%, 
        var(--bg-secondary) 50%, 
        var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

/* ===== Floating Action Button ===== */
.fab-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fab {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.4);
    transition: all 0.3s ease;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(37, 99, 235, 0.5);
}

.fab-dark-toggle {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    box-shadow: 0 4px 20px var(--shadow-color);
}

/* ===== Stagger Reveal Animation ===== */
.stagger-reveal > * {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-reveal.revealed > *:nth-child(1) { transition-delay: 0s; }
.stagger-reveal.revealed > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-reveal.revealed > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-reveal.revealed > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-reveal.revealed > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-reveal.revealed > *:nth-child(6) { transition-delay: 0.5s; }

.stagger-reveal.revealed > * {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Number Counter Animation ===== */
.count-up {
    font-variant-numeric: tabular-nums;
}

/* ===== Magnetic Button Effect ===== */
.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Glow Effects ===== */
.glow-blue {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

.glow-purple {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
}

.glow-green {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
}

/* ===== Progress Ring ===== */
.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring circle {
    transition: stroke-dashoffset 0.5s ease;
}

/* ===== Live Indicator ===== */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 50px;
    font-size: 0.875rem;
    color: #10b981;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* ===== Tooltip ===== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow-color);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-12px);
}

/* ===== Premium Input Fields ===== */
.input-premium {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-premium:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-premium.valid {
    border-color: var(--accent-success);
}

.input-premium.invalid {
    border-color: var(--accent-danger);
}

/* ===== Notification Toast ===== */
.toast-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 10px 40px var(--shadow-color);
    animation: toast-slide-in 0.3s ease;
}

.toast.toast-success { border-left: 4px solid var(--accent-success); }
.toast.toast-warning { border-left: 4px solid var(--accent-warning); }
.toast.toast-error { border-left: 4px solid var(--accent-danger); }

@keyframes toast-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
    .glass-card {
        border-radius: 16px;
    }
    
    .fab-container {
        bottom: 80px;
        right: 15px;
    }
    
    .fab {
        width: 45px;
        height: 45px;
    }
}
