/* ============================================
   Military Game Theme - Auth Page
   Dark tactical UI with glow accents
   ============================================ */

/* ── Color Tokens ── */
:root {
    --bg-primary: #0D1117;
    --bg-secondary: #161B22;
    --bg-tertiary: #1C2333;
    --text-primary: #F0F6FC;
    --text-secondary: #C9D1D9;
    --text-light: #8B949E;
    --accent-primary: #58A6FF;
    --accent-secondary: #79C0FF;
    --accent-gradient: linear-gradient(135deg, #58A6FF 0%, #79C0FF 100%);
    --gold: #FFD700;
    --gold-dim: #B8960C;
    --military-gradient: linear-gradient(135deg, #6B1D1D 0%, #8B6914 50%, #6B1D1D 100%);
    --military-glow: 0 0 20px rgba(255, 215, 0, 0.15);
    --border-color: #30363D;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.65);
    --card-bg: #161B22;
    --hero-gradient: linear-gradient(160deg, #0D1117 0%, #161B22 40%, #1A2233 70%, #0D1117 100%);
    --error-color: #F85149;
    --success-color: #3FB950;
    --glow-blue: rgba(88, 166, 255, 0.35);
    --glow-gold: rgba(255, 215, 0, 0.25);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Rajdhani', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Navbar ── */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(13, 17, 23, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--gold);
    text-decoration: none;
    letter-spacing: 1px;
    text-shadow: 0 0 8px var(--glow-gold);
}

.nav-brand:hover {
    color: #FFE44D;
    text-shadow: 0 0 14px var(--glow-gold);
}

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 4px var(--glow-gold));
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.theme-toggle:hover {
    background: var(--accent-primary);
    color: #fff;
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px var(--glow-blue);
    transform: rotate(180deg);
}

.lang-switch {
    display: none !important;
    gap: 5px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px;
}

.lang-btn {
    background: transparent;
    border: none;
    padding: 6px 15px;
    border-radius: 15px;
    cursor: pointer;
    color: var(--text-light);
    font-weight: 600;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.lang-btn:hover {
    color: var(--text-primary);
}

.lang-btn.active {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: 0 0 10px var(--glow-blue);
}

/* ── Auth Section ── */
.auth-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 20px 40px;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Military-themed background with particles / radial glows */
.auth-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse 900px 600px at 15% 20%, rgba(88, 166, 255, 0.07) 0%, transparent 70%),
        radial-gradient(ellipse 700px 500px at 85% 75%, rgba(255, 215, 0, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 500px 400px at 50% 50%, rgba(107, 29, 29, 0.08) 0%, transparent 60%),
        linear-gradient(180deg,
            #0D1117 0%,
            #0F1620 20%,
            #111D2B 40%,
            #0F1922 60%,
            #0D1117 100%);
    opacity: 1;
}

.auth-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Subtle grid/scanline overlay for military feel */
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(88, 166, 255, 0.012) 2px,
            rgba(88, 166, 255, 0.012) 4px
        ),
        radial-gradient(circle 2px at 20% 30%, rgba(88, 166, 255, 0.15) 0%, transparent 100%),
        radial-gradient(circle 1.5px at 60% 15%, rgba(255, 215, 0, 0.12) 0%, transparent 100%),
        radial-gradient(circle 1px at 80% 60%, rgba(88, 166, 255, 0.10) 0%, transparent 100%),
        radial-gradient(circle 2px at 35% 80%, rgba(255, 215, 0, 0.10) 0%, transparent 100%),
        radial-gradient(circle 1px at 10% 65%, rgba(88, 166, 255, 0.12) 0%, transparent 100%),
        radial-gradient(circle 1.5px at 90% 35%, rgba(255, 215, 0, 0.08) 0%, transparent 100%),
        radial-gradient(circle 1px at 50% 90%, rgba(88, 166, 255, 0.10) 0%, transparent 100%),
        radial-gradient(circle 2px at 75% 10%, rgba(88, 166, 255, 0.09) 0%, transparent 100%),
        radial-gradient(circle 1px at 25% 45%, rgba(255, 215, 0, 0.07) 0%, transparent 100%),
        radial-gradient(circle 1.5px at 45% 70%, rgba(88, 166, 255, 0.08) 0%, transparent 100%),
        radial-gradient(circle 1px at 65% 50%, rgba(255, 215, 0, 0.09) 0%, transparent 100%);
    pointer-events: none;
}

.auth-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        /* Corner vignette */
        radial-gradient(ellipse at top left, transparent 40%, rgba(0, 0, 0, 0.5) 100%),
        radial-gradient(ellipse at bottom right, transparent 40%, rgba(0, 0, 0, 0.5) 100%);
    pointer-events: none;
}

/* ── Auth Card ── */
.auth-card {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow:
        var(--shadow-lg),
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 0 40px rgba(0, 0, 0, 0.3);
    padding: 50px 40px;
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--border-color);
    animation: cardEnter 0.6s ease-out;
    /* Subtle top accent line */
    border-top: 2px solid transparent;
    border-image: linear-gradient(90deg, transparent, var(--gold-dim), var(--accent-primary), var(--gold-dim), transparent) 1;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glow-gold), transparent);
    filter: blur(1px);
    pointer-events: none;
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Auth Header ── */
.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--gold) 0%, #FFE44D 40%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    filter: drop-shadow(0 0 6px var(--glow-gold));
}

.auth-subtitle {
    color: var(--text-light);
    font-size: 1rem;
    letter-spacing: 0.3px;
}

/* ── Auth Tabs ── */
.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    padding: 15px;
    text-align: center;
    font-weight: 600;
    color: var(--text-light);
    text-decoration: none;
    position: relative;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.auth-tab:hover {
    color: var(--accent-primary);
    text-shadow: 0 0 8px var(--glow-blue);
}

.auth-tab.active {
    color: var(--gold);
    text-shadow: 0 0 8px var(--glow-gold);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), var(--accent-primary));
    border-radius: 2px;
    box-shadow: 0 0 8px var(--glow-gold);
}

/* ── Auth Form ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.form-label .required {
    color: var(--error-color);
    margin-left: 4px;
    text-shadow: 0 0 4px rgba(248, 81, 73, 0.4);
}

.form-control {
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(13, 17, 23, 0.7);
    color: var(--text-primary);
    transition: all 0.3s ease;
    caret-color: var(--accent-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12), 0 0 16px rgba(88, 166, 255, 0.08);
    background: rgba(13, 17, 23, 0.9);
}

.form-control::placeholder {
    color: var(--text-light);
    opacity: 0.6;
}

/* ── Phone Input Group ── */
.phone-input-group {
    display: flex;
    gap: 10px;
}

.country-select {
    position: relative;
    min-width: 120px;
}

.country-select-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(13, 17, 23, 0.7);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.country-select-btn:hover,
.country-select-btn:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.1);
}

.country-select-btn .flag {
    font-size: 1.2rem;
}

.country-select-btn .code {
    font-weight: 600;
    color: var(--text-secondary);
}

.country-select-btn .arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    color: var(--text-light);
}

.country-select.open .arrow {
    transform: rotate(180deg);
}

.country-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 0, 0, 0.4);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    margin-top: 5px;
}

.country-select.open .country-dropdown {
    display: block;
}

.country-search {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
}

.country-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: rgba(13, 17, 23, 0.7);
    color: var(--text-primary);
}

.country-search input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.country-list {
    list-style: none;
    padding: 8px 0;
}

.country-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.country-item:hover {
    background: var(--bg-tertiary);
}

.country-item.selected {
    background: var(--bg-tertiary);
    border-left: 2px solid var(--accent-primary);
}

.country-item .flag {
    font-size: 1.2rem;
}

.country-item .name {
    flex: 1;
    color: var(--text-secondary);
}

.country-item .code {
    color: var(--text-light);
    font-weight: 600;
}

.phone-input {
    flex: 1;
}

/* ── Checkbox ── */
.checkbox-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-light);
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.forgot-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.forgot-link:hover {
    color: var(--accent-secondary);
    text-shadow: 0 0 6px var(--glow-blue);
}

/* ── Buttons ── */
.btn {
    padding: 14px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.btn-primary {
    background: var(--military-gradient);
    color: var(--gold);
    width: 100%;
    border: 1px solid rgba(255, 215, 0, 0.25);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    box-shadow:
        0 4px 14px rgba(107, 29, 29, 0.4),
        inset 0 1px 0 rgba(255, 215, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(107, 29, 29, 0.5),
        0 0 20px rgba(255, 215, 0, 0.15),
        inset 0 1px 0 rgba(255, 215, 0, 0.2);
    border-color: rgba(255, 215, 0, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(107, 29, 29, 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    width: 100%;
}

.btn-outline:hover {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-secondary);
    box-shadow: 0 0 14px var(--glow-blue);
    border-color: var(--accent-secondary);
}

/* ── Auth Divider ── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 25px 0;
}

.auth-divider span {
    color: var(--text-light);
    font-size: 0.9rem;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

/* ── Auth Footer ── */
.auth-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.auth-footer a:hover {
    color: var(--accent-secondary);
    text-shadow: 0 0 8px var(--glow-blue);
}

/* ── Page Footer ── */
.footer {
    background: var(--bg-secondary);
    padding: 30px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ── Form Errors ── */
.form-error {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
    text-shadow: 0 0 4px rgba(248, 81, 73, 0.3);
}

.form-group.has-error .form-control {
    border-color: var(--error-color);
    box-shadow: 0 0 0 2px rgba(248, 81, 73, 0.12);
}

.form-group.has-error .form-error {
    display: block;
}

/* ── Help Text ── */
.help-block {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 5px;
}

/* ── Captcha ── */
.captcha-group {
    display: flex;
    gap: 10px;
}

.captcha-group .form-control {
    flex: 1;
}

.captcha-btn {
    padding: 14px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--accent-primary);
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.captcha-btn:hover:not(:disabled) {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
    box-shadow: 0 0 12px var(--glow-blue);
}

.captcha-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    color: var(--text-light);
}

/* ── Password Toggle ── */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-control {
    padding-right: 50px;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.password-toggle:hover {
    color: var(--accent-primary);
    text-shadow: 0 0 6px var(--glow-blue);
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.4);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    border: 1px solid var(--border-color);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    color: var(--error-color);
    text-shadow: 0 0 6px rgba(248, 81, 73, 0.4);
}

/* ── Invite Info ── */
.invite-info {
    background: rgba(88, 166, 255, 0.06);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 3px solid var(--accent-primary);
    border: 1px solid rgba(88, 166, 255, 0.15);
    border-left: 3px solid var(--accent-primary);
}

.invite-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.invite-info strong {
    color: var(--gold);
    text-shadow: 0 0 4px var(--glow-gold);
}

/* ── Scrollbar (for dropdowns) ── */
.country-dropdown::-webkit-scrollbar {
    width: 6px;
}

.country-dropdown::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.country-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.country-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .navbar .container {
        padding: 10px 15px;
    }

    .nav-brand {
        font-size: 1.2rem;
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    .nav-controls {
        gap: 8px;
    }

    .theme-toggle {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .lang-btn {
        padding: 5px 10px;
        font-size: 0.85rem;
    }

    .auth-section {
        padding: 80px 15px 30px;
    }

    .auth-card {
        padding: 35px 25px;
    }

    .auth-title {
        font-size: 1.8rem;
    }

    .phone-input-group {
        flex-direction: column;
    }

    .country-select {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .navbar .container {
        padding: 8px 10px;
    }

    .nav-brand {
        font-size: 1rem;
    }

    .logo-icon {
        font-size: 1.3rem;
    }

    .auth-card {
        padding: 30px 20px;
        border-radius: 12px;
    }

    .auth-title {
        font-size: 1.5rem;
    }

    .form-control {
        padding: 12px 14px;
    }

    .btn {
        padding: 12px 20px;
    }

    .checkbox-group {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Focus-visible for accessibility ── */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ── Selection ── */
::selection {
    background: rgba(88, 166, 255, 0.3);
    color: var(--text-primary);
}
