/* ============================================
   AuthPortal — Main Stylesheet
   Modern Dark Glassmorphism Design
   ============================================ */

:root {
    --clr-bg:          #080b14;
    --clr-surface:     rgba(255, 255, 255, 0.05);
    --clr-surface-hov: rgba(255, 255, 255, 0.08);
    --clr-border:      rgba(255, 255, 255, 0.10);
    --clr-border-hov:  rgba(255, 255, 255, 0.22);

    --clr-primary:     #6c63ff;
    --clr-primary-end: #a78bfa;
    --clr-accent:      #38bdf8;

    --clr-text:        #f1f5f9;
    --clr-muted:       #94a3b8;
    --clr-label:       #cbd5e1;

    --clr-error:       #f87171;
    --clr-error-bg:    rgba(248, 113, 113, 0.10);
    --clr-success:     #4ade80;
    --clr-success-bg:  rgba(74, 222, 128, 0.10);

    --radius-sm:  8px;
    --radius-md:  14px;
    --radius-lg:  20px;
    --radius-xl:  28px;

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-card: 0 8px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

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

/* ---- Animated Background ---- */
.bg-animation {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.35;
    animation: floatOrb 16s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #6c63ff, transparent 70%);
    top: -120px;
    left: -120px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #38bdf8, transparent 70%);
    bottom: -80px;
    right: -80px;
    animation-delay: -6s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #a78bfa, transparent 70%);
    top: 50%;
    left: 55%;
    animation-delay: -12s;
}

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

/* ============================================
   AUTH PAGE
   ============================================ */
.auth-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 1.5rem;
}

/* ---- Brand ---- */
.brand {
    text-align: center;
    animation: fadeDown 0.6s ease both;
}

.brand-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-end));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 32px rgba(108, 99, 255, 0.4);
}

.brand-icon svg { width: 32px; height: 32px; color: #fff; }
.brand-icon.small { width: 36px; height: 36px; border-radius: var(--radius-sm); }
.brand-icon.small svg { width: 18px; height: 18px; }

.brand-name {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--clr-text), var(--clr-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.brand-tagline {
    font-size: 0.875rem;
    color: var(--clr-muted);
    margin-top: 0.25rem;
}

/* ---- Alerts ---- */
.alert {
    width: 100%;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideIn 0.4s ease both;
    border: 1px solid transparent;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; }

.alert-error {
    background: var(--clr-error-bg);
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--clr-error);
}

.alert-success {
    background: var(--clr-success-bg);
    border-color: rgba(74, 222, 128, 0.3);
    color: var(--clr-success);
}

/* ---- Card ---- */
.card {
    width: 100%;
    max-width: 520px;
    background: var(--clr-surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    animation: fadeUp 0.6s ease 0.1s both;
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--clr-border);
}

.tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    color: var(--clr-muted);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color var(--transition);
    letter-spacing: 0.01em;
}

.tab.active { color: var(--clr-text); }
.tab:hover:not(.active) { color: var(--clr-label); }

.tab-indicator {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 50%;
    height: 2px;
    background: linear-gradient(90deg, var(--clr-primary), var(--clr-primary-end));
    border-radius: 99px;
    transition: left var(--transition);
    box-shadow: 0 0 12px rgba(108, 99, 255, 0.6);
}

/* ---- Panels ---- */
.panel {
    display: none;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.panel.active { display: block; }

/* ---- Form Groups ---- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.1rem;
}

label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--clr-label);
    letter-spacing: 0.02em;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 0.875rem;
    width: 16px;
    height: 16px;
    color: var(--clr-muted);
    pointer-events: none;
    transition: color var(--transition);
    flex-shrink: 0;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem 2.75rem 0.75rem 2.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    color: var(--clr-text);
    font-family: inherit;
    font-size: 0.875rem;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
    outline: none;
}

input::placeholder { color: rgba(148, 163, 184, 0.5); }

input:focus {
    border-color: var(--clr-primary);
    background: rgba(108, 99, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

input:focus + .input-icon,
.input-wrap:focus-within .input-icon { color: var(--clr-primary); }

.toggle-pw {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    color: var(--clr-muted);
    transition: color var(--transition);
}

.toggle-pw:hover { color: var(--clr-text); }
.toggle-pw svg { width: 16px; height: 16px; }

/* ---- Password Strength ---- */
.strength-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    min-height: 20px;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    transition: width 0.4s ease, background 0.4s ease;
}

.strength-label {
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 48px;
    text-align: right;
    color: var(--clr-muted);
}

/* ---- Primary Button ---- */
.btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-end));
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.35);
    letter-spacing: 0.01em;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: background var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(108, 99, 255, 0.5);
}

.btn-primary:hover::before { background: rgba(255, 255, 255, 0.08); }
.btn-primary:active { transform: translateY(0); }
.btn-primary svg { width: 18px; height: 18px; }

/* ---- Footer ---- */
.footer-note {
    font-size: 0.75rem;
    color: var(--clr-muted);
    opacity: 0.6;
    text-align: center;
}

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

/* ---- Navbar ---- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(8, 11, 20, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--clr-border);
    position: sticky;
    top: 0;
    z-index: 10;
    animation: fadeDown 0.5s ease both;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--clr-text);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.4);
}

.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--clr-text);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.25);
    border-radius: var(--radius-sm);
    color: var(--clr-error);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.btn-logout:hover {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(248, 113, 113, 0.5);
    transform: translateY(-1px);
}

.btn-logout svg { width: 15px; height: 15px; }

/* ---- Dashboard Main ---- */
.dashboard-main {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: fadeUp 0.6s ease 0.1s both;
}

/* ---- Welcome Banner ---- */
.welcome-banner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.15), rgba(167, 139, 250, 0.08));
    border: 1px solid rgba(108, 99, 255, 0.25);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(16px);
}

.welcome-avatar {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(108, 99, 255, 0.4);
}

.welcome-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--clr-text), var(--clr-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-text p { font-size: 0.875rem; color: var(--clr-muted); margin-top: 0.25rem; }

/* ---- Stats Grid ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--clr-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
    border-color: var(--clr-border-hov);
    transform: translateY(-3px);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-icon-blue   { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.stat-icon-purple { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.stat-icon-teal   { background: rgba(45, 212, 191, 0.15); color: #2dd4bf; }
.stat-icon-green  { background: rgba(74, 222, 128, 0.15); color: #4ade80; }

.stat-info { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.stat-label { font-size: 0.7rem; font-weight: 500; color: var(--clr-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 0.875rem; font-weight: 600; color: var(--clr-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Detail Card ---- */
.detail-card {
    background: var(--clr-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
}

.detail-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--clr-text);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--clr-border);
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.detail-item { display: flex; flex-direction: column; gap: 0.3rem; }
.detail-key  { font-size: 0.75rem; font-weight: 500; color: var(--clr-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.detail-val  { font-size: 0.9rem; font-weight: 500; color: var(--clr-text); }

.badge-active {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    background: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 99px;
    color: var(--clr-success);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--clr-success);
    border-radius: 50%;
    animation: pulse 2s ease infinite;
}

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

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

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

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 560px) {
    .form-row    { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .navbar      { padding: 0.875rem 1rem; }
    .user-name   { display: none; }
    .welcome-banner { flex-direction: column; text-align: center; }
    .stats-grid  { grid-template-columns: 1fr; }
    .panel       { padding: 1.5rem; }
}
