/* ============================================================
   Shadow Wars - Horus Heresy: Redes de Traición
   Estética: Grimdark militar, pergamino imperial, oscuridad táctica
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=Share+Tech+Mono&display=swap');

/* ---- Variables ---- */
:root {
    --gold:       #c9a84c;
    --gold-dim:   #8a6f2e;
    --gold-bright:#e8c96a;
    --bg:         #05050a;
    --bg-2:       #0c0c14;
    --bg-3:       #12121e;
    --bg-card:    #0e0e18;
    --border:     #1e1e30;
    --border-gold:#2a2010;
    --text:       #c8c0b0;
    --text-dim:   #7a7268;
    --text-bright:#e8e0cc;
    --red:        #8b1a1a;
    --red-bright: #c0392b;
    --loyal:      #1a3a6b;
    --loyal-light:#2e5fa3;
    --traitor:    #4a0e0e;
    --traitor-light:#8b1a1a;
    --success:    #2d5a3d;
    --success-text:#5ab87a;
    --error:      #5a1a1a;
    --error-text: #e05050;
    --radius:     2px;
    --shadow:     0 4px 24px rgba(0,0,0,.8);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 1.05rem;
    line-height: 1.7;
    min-height: 100vh;
}

/* ---- Fondo con textura ---- */
body::before {
    content: '';
    position: fixed; inset: 0; z-index: 0;
    background:
        radial-gradient(ellipse 80% 40% at 50% 0%, rgba(201,168,76,.04) 0%, transparent 70%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='1' height='1' fill='%23ffffff08'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* ---- Tipografía ---- */
h1, h2, h3, h4 {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    color: var(--text-bright);
    letter-spacing: .05em;
    line-height: 1.2;
}
.mono { font-family: 'Share Tech Mono', monospace; }

/* ---- Layout general ---- */
.site-wrap {
    position: relative; z-index: 1;
    min-height: 100vh;
    display: flex; flex-direction: column;
}

/* ---- Header ---- */
.site-header {
    border-bottom: 1px solid var(--border-gold);
    background: linear-gradient(180deg, rgba(0,0,0,.9) 0%, transparent 100%);
    padding: 0 2rem;
}
.header-inner {
    max-width: 1100px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
}
.logo {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none;
}
.logo-icon {
    width: 36px; height: 36px;
    border: 1px solid var(--gold-dim);
    display: flex; align-items: center; justify-content: center;
    color: var(--gold);
    font-size: 18px;
    transform: rotate(45deg);
}
.logo-icon span { transform: rotate(-45deg); display: block; }
.logo-text {
    font-family: 'Cinzel', serif;
    font-size: .75rem;
    letter-spacing: .2em;
    color: var(--gold);
    text-transform: uppercase;
    line-height: 1.3;
}
.logo-text strong {
    display: block;
    font-size: 1.1rem;
    letter-spacing: .1em;
    color: var(--text-bright);
}

/* ---- Divisor decorativo ---- */
.divider {
    display: flex; align-items: center; gap: 12px;
    margin: 1.5rem 0;
    color: var(--gold-dim);
    font-size: .7rem;
    letter-spacing: .3em;
    text-transform: uppercase;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim) 50%, transparent);
}

/* ---- Auth Layout ---- */
.auth-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}
.auth-container {
    width: 100%; max-width: 440px;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-top: 2px solid var(--gold-dim);
    padding: 2.5rem 2.5rem 2rem;
    position: relative;
}
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold) 50%, transparent);
}
.auth-title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: .25rem;
}
.auth-subtitle {
    text-align: center;
    font-size: .85rem;
    color: var(--text-dim);
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

/* ---- Formularios ---- */
.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: .75rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: .4rem;
}
.form-input {
    width: 100%;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .65rem .85rem;
    color: var(--text-bright);
    font-family: 'Share Tech Mono', monospace;
    font-size: .9rem;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.form-input:focus {
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 2px rgba(201,168,76,.12);
}
.form-input::placeholder { color: var(--text-dim); opacity: .6; }

/* Password strength meter */
.strength-bar {
    height: 2px;
    background: var(--border);
    margin-top: 6px;
    border-radius: 1px;
    overflow: hidden;
}
.strength-fill {
    height: 100%;
    width: 0%;
    transition: width .3s, background .3s;
}

/* ---- Checkbox GDPR ---- */
.checkbox-group {
    display: flex; align-items: flex-start; gap: 10px;
    margin-bottom: 1.25rem;
}
.checkbox-group input[type="checkbox"] {
    width: 16px; height: 16px;
    flex-shrink: 0;
    margin-top: 3px;
    accent-color: var(--gold);
    cursor: pointer;
}
.checkbox-label {
    font-size: .85rem;
    color: var(--text-dim);
    line-height: 1.5;
}
.checkbox-label a {
    color: var(--gold-dim);
    text-decoration: none;
    transition: color .2s;
}
.checkbox-label a:hover { color: var(--gold); }

/* ---- Botones ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: .7rem 1.5rem;
    border: none; border-radius: var(--radius);
    font-family: 'Cinzel', serif;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
    position: relative; overflow: hidden;
}
.btn-primary {
    background: linear-gradient(135deg, var(--gold-dim), var(--gold));
    color: #0a0a0f;
    width: 100%;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--gold), var(--gold-bright));
    box-shadow: 0 0 20px rgba(201,168,76,.3);
}
.btn-primary:disabled {
    opacity: .5; cursor: not-allowed;
}
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-gold);
    color: var(--gold-dim);
    width: 100%;
}
.btn-ghost:hover { border-color: var(--gold-dim); color: var(--gold); }

/* Loading spinner en botón */
.btn .spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(0,0,0,.2);
    border-top-color: #0a0a0f;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    display: none;
}
.btn.loading .spinner { display: block; }
.btn.loading .btn-text { opacity: 0; }

/* ---- Mensajes de alerta ---- */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: 1.25rem;
    display: none;
    border-left: 3px solid;
}
.alert.show { display: flex; align-items: flex-start; gap: 8px; }
.alert-error {
    background: var(--error);
    border-color: var(--error-text);
    color: var(--error-text);
}
.alert-success {
    background: var(--success);
    border-color: var(--success-text);
    color: var(--success-text);
}

/* ---- Auth links ---- */
.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    font-size: .85rem;
    color: var(--text-dim);
}
.auth-links a {
    color: var(--gold-dim);
    text-decoration: none;
    transition: color .2s;
}
.auth-links a:hover { color: var(--gold); }

/* ---- Faction selector ---- */
.faction-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
    margin-bottom: 1.25rem;
}
.faction-card {
    border: 1px solid var(--border);
    padding: 1rem;
    cursor: pointer;
    transition: all .2s;
    position: relative;
}
.faction-card:hover { border-color: var(--gold-dim); }
.faction-card.selected-loyal {
    border-color: var(--loyal-light);
    background: rgba(26,58,107,.2);
}
.faction-card.selected-traitor {
    border-color: var(--traitor-light);
    background: rgba(74,14,14,.2);
}
.faction-card input[type="radio"] { display: none; }
.faction-name {
    font-family: 'Cinzel', serif;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .1em;
    margin-bottom: .4rem;
}
.faction-loyal .faction-name { color: var(--loyal-light); }
.faction-traitor .faction-name { color: var(--traitor-light); }
.faction-desc {
    font-size: .78rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    font-size: .78rem;
    color: var(--text-dim);
}
.site-footer a { color: var(--gold-dim); text-decoration: none; }
.site-footer a:hover { color: var(--gold); }

/* ---- Animaciones ---- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.auth-card { animation: fadeIn .4s ease forwards; }

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .auth-card { padding: 1.75rem 1.25rem; }
    .faction-grid { grid-template-columns: 1fr; }
}
