/* ==================== VARIABLES ==================== */
:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-card: rgba(18, 18, 20, 0.8);
    --bg-card-hover: rgba(28, 28, 32, 0.9);
    --text-primary: #fafafa;
    --text-secondary: #71717a;
    --text-muted: #52525b;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --accent-hover: #818cf8;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --error: #f87171;
    --success: #34d399;
    --gradient-1: #6366f1;
    --gradient-2: #8b5cf6;
    --gradient-3: #a855f7;
}

/* ==================== 3D BACKGROUND CANVAS ==================== */
.bg3d-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.5s ease;
}

/* Ensure content stays above 3D background */
.login-screen,
.dashboard {
    position: relative;
    z-index: 10;
}

/* ==================== RESET ==================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ==================== ANIMATED BACKGROUND ==================== */
.bg-gradient {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(139, 92, 246, 0.1), transparent),
        radial-gradient(ellipse 40% 60% at 0% 80%, rgba(168, 85, 247, 0.08), transparent);
    z-index: 0;
    pointer-events: none;
}

.bg-grid {
    position: fixed;
    inset: 0;
    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: 60px 60px;
    z-index: 0;
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
    animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* ==================== LOGIN SCREEN ==================== */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    border-radius: 16px;
    margin-bottom: 24px;
    color: white;
    box-shadow: 0 8px 32px -8px var(--accent-glow);
}

.login-title {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ==================== FORM ==================== */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
}

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

.form-input:hover {
    border-color: var(--border-hover);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: var(--text-secondary);
}

.error-message {
    padding: 12px 16px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 10px;
    color: var(--error);
    font-size: 13px;
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 16px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px -8px var(--accent-glow);
}

.login-btn:active:not(:disabled) {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader .spinner {
    animation: spin 1s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

.login-footer {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 32px;
}

/* ==================== DASHBOARD ==================== */
.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 40px;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 10, 11, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    border-radius: 10px;
    color: white;
}

.brand-name {
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.reset-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-family: inherit;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reset-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.reset-btn:active {
    transform: scale(0.95);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    color: var(--error);
    border-color: var(--error);
    background: rgba(248, 113, 113, 0.1);
}

/* ==================== DASHBOARD MAIN ==================== */
.dashboard-main {
    flex: 1;
    padding: 60px 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.welcome-section {
    text-align: center;
    margin-bottom: 60px;
}

.welcome-title {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

/* ==================== PROJECTS GRID ==================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.project-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px 28px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: block;
}

.project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

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

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-hover);
    box-shadow:
        0 20px 40px -20px rgba(99, 102, 241, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

.project-card:hover::before {
    opacity: 0.05;
}

.project-card-content {
    position: relative;
    z-index: 1;
}

.project-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    border-radius: 14px;
    margin-bottom: 20px;
    color: white;
    box-shadow: 0 8px 24px -8px var(--accent-glow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover .project-icon {
    transform: scale(1.05);
    box-shadow: 0 12px 32px -8px var(--accent-glow);
}

.project-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.3px;
    margin-bottom: 8px;
}

.project-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

.project-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.project-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.project-arrow {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    opacity: 0;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.project-card:hover .project-arrow {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ==================== FOOTER ==================== */
.dashboard-footer {
    padding: 24px 40px;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
}

/* ==================== UTILITIES ==================== */
.hidden {
    display: none !important;
}

/* ==================== RESPONSIVE ==================== */
@media screen and (max-width: 768px) {
    .login-card {
        padding: 36px 28px;
        border-radius: 20px;
    }

    .login-logo {
        width: 56px;
        height: 56px;
    }

    .login-title {
        font-size: 24px;
    }

    .dashboard-header {
        padding: 16px 20px;
    }

    .dashboard-main {
        padding: 40px 20px;
    }

    .welcome-title {
        font-size: 32px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 480px) {
    .login-screen {
        padding: 16px;
    }

    .login-card {
        padding: 28px 24px;
        border-radius: 16px;
    }

    .login-logo {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .login-title {
        font-size: 22px;
    }

    .form-input {
        padding: 12px 14px;
        font-size: 16px;
    }

    .brand-name {
        display: none;
    }

    .welcome-title {
        font-size: 28px;
    }

    .welcome-subtitle {
        font-size: 14px;
    }

    .project-card {
        padding: 24px 20px;
    }
}