:root {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.6);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --error: #ef4444;
    --success: #22c55e;
    --font-heading: 'Outfit', system-ui, sans-serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --glass-blur: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    /* Modern mesh gradient background */
    background-image: 
        radial-gradient(at 0% 0%, rgba(15, 23, 42, 1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.4) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(30, 64, 175, 0.4) 0, transparent 50%),
        radial-gradient(at 0% 100%, rgba(16, 185, 129, 0.1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

/* Glassmorphism utility */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

/* Auth Pages */
.auth-wrapper {
    width: 100%;
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 3rem;
    animation: zoomIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

/* Subtle glow behind card */
.auth-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent 0%, rgba(139, 92, 246, 0.1) 25%, transparent 50%);
    animation: rotateGlow 10s linear infinite;
    z-index: -1;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #e2e8f0, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
    background: rgba(15, 23, 42, 0.8);
}

.btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, #4c1d95 100%);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    letter-spacing: 0.025em;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-20deg);
    transition: all 0.5s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(139, 92, 246, 0.4);
}

.btn:hover::after {
    left: 200%;
}

.alert {
    padding: 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease-out;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Dashboard Layout */
.dashboard-header {
    padding: 2rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.dashboard-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dashboard-title h1 {
    font-size: 1.5rem;
    margin: 0;
    background: linear-gradient(to right, #e2e8f0, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.welcome-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.welcome-text span {
    color: var(--text-main);
    font-weight: 600;
}

.logout-link {
    color: var(--error);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.1);
}

.dashboard-main {
    padding: 3rem 5%;
    flex-grow: 1;
}

.dashboard-intro {
    text-align: center;
    margin-bottom: 4rem;
    animation: fadeIn 0.6s ease-out;
}

.dashboard-intro h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.dashboard-intro p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.app-card {
    position: relative;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    color: inherit;
    animation: slideUp 0.5s ease-out backwards;
}

/* Stagger card animations */
.app-card:nth-child(1) { animation-delay: 0.1s; }
.app-card:nth-child(2) { animation-delay: 0.2s; }
.app-card:nth-child(3) { animation-delay: 0.3s; }
.app-card:nth-child(4) { animation-delay: 0.4s; }
.app-card:nth-child(5) { animation-delay: 0.5s; }
.app-card:nth-child(6) { animation-delay: 0.6s; }
.app-card:nth-child(7) { animation-delay: 0.7s; }

.app-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5), 0 0 20px rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    z-index: 2;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.05);
    font-size: 1.8rem;
    transition: all 0.3s ease;
}

.app-card:hover .card-icon {
    background: linear-gradient(135deg, var(--primary), #4c1d95);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
    transform: scale(1.1) rotate(5deg);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.card-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    transition: gap 0.3s ease;
}

.app-card:hover .card-action {
    gap: 0.75rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

/* Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
        padding: 1.5rem;
    }
    .user-profile {
        flex-direction: column;
        gap: 1rem;
    }
    .dashboard-main {
        padding: 2rem 1.5rem;
    }
    .dashboard-intro h2 {
        font-size: 2rem;
    }
    .cards-grid {
        grid-template-columns: 1fr;
    }
}
