﻿/* ============================================================
   AUTH SYSTEM — Styles CSS
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@300;400;500;600;700&family=Roboto+Slab:wght@400;700&display=swap');

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

:root {
    --bg:          #f0f4f8;
    --surface:     #ffffff;
    --surface-2:   #f8fafc;
    --border:      #e2e8f0;
    --accent:      #2D6CDF;
    --accent-glow: rgba(45,108,223,.2);
    --success:     #16a34a;
    --error:       #dc2626;
    --text:        #1a1a2e;
    --muted:       #828282;
    --radius:      14px;
    --font:        'Source Sans 3', 'Sora', sans-serif;
}

body {
    font-family: var(--font);
    background: transparent;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('../../../images/IOBBA_Background.jpg') center / cover no-repeat;
    filter: blur(12px) brightness(0.3);
    transform: scale(1.05);
    z-index: -1;
}

/* ─── AUTH CARD ─────────────────────────────────────────── */

.auth-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 1.5rem;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) * 1.5);
    padding: 2.5rem 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,.08);
    animation: slideUp .4s cubic-bezier(.16,1,.3,1);
}

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

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

.auth-logo {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    display: block;
}

.auth-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
}

.auth-header p {
    color: var(--muted);
    font-size: .9rem;
    margin-top: .4rem;
}

/* ─── FORM ──────────────────────────────────────────────── */

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

label {
    display: flex;
    justify-content: space-between;
    font-size: .85rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: .5rem;
}

.label-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 400;
}
.label-link:hover { text-decoration: underline; }

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: .75rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: .95rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

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

input::placeholder { color: #94a3b8; }

.input-eye-wrap {
    position: relative;
}

.input-eye-wrap input {
    padding-right: 3rem;
}

.toggle-eye {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: .5;
    transition: opacity .2s;
    box-shadow: none;
    min-height: unset;
}
.toggle-eye:hover { opacity: 1; box-shadow: none; }

/* ─── PASSWORD STRENGTH ─────────────────────────────────── */

.password-strength {
    height: 4px;
    border-radius: 99px;
    margin-top: 8px;
    transition: all .3s;
    background: var(--border);
    overflow: hidden;
}

.password-strength::after {
    content: '';
    display: block;
    height: 100%;
    border-radius: 99px;
    transition: width .3s, background .3s;
}

.password-strength[data-score="1"]::after { width: 25%; background: var(--error); }
.password-strength[data-score="2"]::after { width: 50%; background: #f59e0b; }
.password-strength[data-score="3"]::after { width: 75%; background: #3b82f6; }
.password-strength[data-score="4"]::after { width: 100%; background: var(--success); }

/* ─── BUTTONS ───────────────────────────────────────────── */

.btn-primary {
    width: 100%;
    padding: .85rem;
    background: linear-gradient(135deg, var(--accent), #1F5F8B);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: .5rem;
    transition: opacity .2s, transform .1s, box-shadow .2s;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    opacity: 0.92;
    box-shadow: 0 6px 28px rgba(45,108,223,.35);
    transform: translateY(-1px);
}

.btn-primary:active { transform: scale(.98); }

/* ─── ALERTS ────────────────────────────────────────────── */

.alert {
    border-radius: var(--radius);
    padding: .9rem 1rem;
    margin-bottom: 1.2rem;
    font-size: .875rem;
    line-height: 1.5;
}

.alert p { margin: 0; }
.alert p + p { margin-top: 4px; }

.alert-error {
    background: rgba(220,38,38,.08);
    border: 1px solid rgba(220,38,38,.25);
    color: #b91c1c;
}

.alert-success {
    background: rgba(22,163,74,.08);
    border: 1px solid rgba(22,163,74,.25);
    color: #15803d;
}

.alert-success a {
    color: var(--success);
    font-weight: 600;
}

/* ─── FOOTER LINK ───────────────────────────────────────── */

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: .875rem;
    color: var(--muted);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.auth-footer a:hover { text-decoration: underline; }

/* ─── DASHBOARD ─────────────────────────────────────────── */

body:has(.dashboard-wrapper) {
    display: block;
    background: transparent;
}

.dashboard-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 8px rgba(0,0,0,.05);
}

.dashboard-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

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

.user-badge {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
    color: var(--muted);
}

.role-tag {
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.role-admin     { background: rgba(239,68,68,.12);  color: #b91c1c; }
.role-user      { background: rgba(45,108,223,.12);  color: #205d8f; }
.role-moderator { background: rgba(245,158,11,.12); color: #b45309; }

.btn-logout {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    padding: .4rem .9rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 500;
    transition: all .2s;
    box-shadow: none;
}
.btn-logout:hover { border-color: #dc2626; color: #b91c1c; background: rgba(220,38,38,.06); box-shadow: none; }

.dashboard-main {
    max-width: 900px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
    width: 100%;
}

.welcome-card {
    background: linear-gradient(135deg, #ffffff, #f8fafc);
    border: 1px solid #e2e8f0;
    border-radius: calc(var(--radius) * 1.5);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.welcome-card h2 { font-size: 1.5rem; margin-bottom: .5rem; }
.welcome-card p  { color: var(--muted); }
.last-login { font-size: .8rem; margin-top: .75rem !important; }

.admin-panel {
    background: rgba(220,38,38,.05);
    border: 1px solid rgba(220,38,38,.2);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-panel h3 { color: #b91c1c; margin-bottom: .4rem; }
.admin-panel p  { color: var(--muted); font-size: .9rem; }

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.info-icon { font-size: 1.75rem; margin-bottom: .5rem; }
.info-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.info-value { font-size: .95rem; font-weight: 600; margin-top: .25rem; }

/* ─── RESPONSIVE ────────────────────────────────────────── */

@media (max-width: 768px) {
    .auth-wrapper { max-width: 400px; padding: 1rem; }
    .auth-card { padding: 2rem 1.5rem; }
    .dashboard-header { padding: .75rem 1rem; }
    .dashboard-main { margin: 1.5rem auto; }
    .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .auth-card { padding: 2rem 1.25rem; }
    .dashboard-header { padding: .75rem 1rem; }
    .dashboard-main { margin: 1.5rem auto; }
}
