/**
 * Code of Conquest - Main Stylesheet
 * RPG/Fantasy Theme with Dark Slate Gray Color Scheme
 */

/* ===== CSS VARIABLES ===== */
:root {
    /* Backgrounds - Approved colors from mockup */
    --bg-primary: #2C3E50;
    --bg-secondary: #2A3947;      /* Darkened for better contrast */
    --bg-tertiary: #1A252F;
    --bg-input: #1F2D3A;          /* Darkened for better contrast */

    /* Accents */
    --accent-gold: #F39C12;
    --accent-gold-hover: #E67E22;
    --accent-red: #C0392B;
    --accent-red-light: #E74C3C;  /* Lighter for better contrast on dark backgrounds */
    --accent-green: #27AE60;
    --accent-blue: #3498DB;

    /* Text */
    --text-primary: #ECF0F1;
    --text-secondary: #BDC3C7;
    --text-muted: #95A5A6;

    /* Borders */
    --border-primary: #4A5F7F;
    --border-ornate: #8B7355;
    --border-glow: #F39C12;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(243, 156, 18, 0.3);

    /* Typography */
    --font-heading: 'Cinzel', serif;
    --font-body: 'Lato', sans-serif;
    --font-mono: 'Courier New', monospace;

    /* Font Sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-tertiary);
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--border-ornate);
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--accent-gold);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.logo:hover {
    color: var(--accent-gold-hover);
    text-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-greeting {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.logout-form {
    display: inline;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-gold);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: color 0.3s ease;
}

.btn-link:hover {
    color: var(--accent-gold-hover);
    text-shadow: 0 0 8px rgba(243, 156, 18, 0.3);
}

/* ===== MAIN CONTENT ===== */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ===== AUTH CONTAINER ===== */
.auth-container {
    max-width: 450px;
    width: 100%;
    padding: 2.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-ornate);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    position: relative;
}

/* Ornate corner decorations */
.auth-container::before,
.auth-container::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 2px solid var(--accent-gold);
}

.auth-container::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.auth-container::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

/* ===== TYPOGRAPHY ===== */
.page-title {
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--accent-gold);
    text-align: center;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.page-subtitle {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: var(--text-base);
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.2);
}

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

/* Checkbox styling */
.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox-input {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    accent-color: var(--accent-gold);
}

.checkbox-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    width: 100%;
    padding: 0.875rem 2rem;
    font-family: var(--font-heading);
    font-size: var(--text-base);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-hover) 100%);
    border-color: var(--accent-gold);
    color: var(--bg-primary);
}

.btn-primary:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-secondary {
    background: transparent;
    border-color: var(--border-primary);
    color: var(--text-primary);
    margin-top: 1rem;
}

.btn-secondary:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    background: rgba(243, 156, 18, 0.1);
}

/* ===== FLASH MESSAGES ===== */
.flash-messages-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    max-width: 400px;
}

.flash-message {
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    font-size: var(--text-sm);
    border-left: 4px solid;
    position: relative;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.flash-message.flash-error {
    background: rgba(192, 57, 43, 0.2);
    border-color: var(--accent-red);
    color: var(--text-primary);
}

.flash-message.flash-success {
    background: rgba(39, 174, 96, 0.2);
    border-color: var(--accent-green);
    color: var(--text-primary);
}

.flash-message.flash-info {
    background: rgba(52, 152, 219, 0.2);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.flash-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--text-xl);
    cursor: pointer;
    transition: color 0.3s ease;
}

.flash-close:hover {
    color: var(--text-primary);
}

/* ===== ERROR/SUCCESS MESSAGES (Inline) ===== */
.message {
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    font-size: var(--text-sm);
    border-left: 4px solid;
}

.error-message {
    background: rgba(192, 57, 43, 0.2);
    border-color: var(--accent-red);
    color: var(--text-primary);
}

.success-message {
    background: rgba(39, 174, 96, 0.2);
    border-color: var(--accent-green);
    color: var(--text-primary);
}

.info-message {
    background: rgba(52, 152, 219, 0.2);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.field-error {
    display: block;
    margin-top: 0.25rem;
    color: var(--accent-red-light);  /* Using lighter red for better contrast */
    font-size: var(--text-xs);
    font-style: italic;
}

/* ===== LINKS ===== */
.form-links {
    margin-top: 1.5rem;
    text-align: center;
}

.form-link {
    color: var(--accent-gold);
    text-decoration: none;
    font-size: var(--text-sm);
    transition: color 0.3s ease;
}

.form-link:hover {
    color: var(--accent-gold-hover);
    text-shadow: 0 0 8px rgba(243, 156, 18, 0.3);
}

.divider {
    margin: 1rem 0;
    color: var(--text-muted);
    font-size: var(--text-xs);
}

/* ===== FOOTER ===== */
.footer {
    background: var(--bg-tertiary);
    padding: 1.5rem 2rem;
    border-top: 2px solid var(--border-ornate);
    text-align: center;
}

.footer-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* ===== DECORATIVE ELEMENTS ===== */
.decorative-line {
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent-gold) 50%,
        transparent 100%);
    margin: 1.5rem 0;
}

/* ===== PASSWORD STRENGTH INDICATOR ===== */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
}

.strength-weak {
    width: 33%;
    background: var(--accent-red);
}

.strength-medium {
    width: 66%;
    background: var(--accent-gold);
}

.strength-strong {
    width: 100%;
    background: var(--accent-green);
}

.strength-text {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .header {
        padding: 1rem 1.5rem;
    }

    .logo {
        font-size: var(--text-xl);
    }

    .auth-container {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .auth-container::before,
    .auth-container::after {
        width: 30px;
        height: 30px;
    }

    .page-title {
        font-size: var(--text-2xl);
    }

    main {
        padding: 1rem;
    }

    .flash-messages-container {
        left: 1rem;
        right: 1rem;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: var(--text-lg);
    }

    .page-title {
        font-size: var(--text-xl);
    }

    .auth-container {
        padding: 1.5rem 1rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: var(--text-sm);
    }
}

/* ===== HTMX LOADING INDICATORS ===== */
.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-indicator {
    display: none;
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid var(--bg-input);
    border-top: 3px solid var(--accent-gold);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.hidden {
    display: none;
}
