/* --- Variables and Base --- */
:root {
    --primary-color: #18181b;
    --primary-strong: #111827;
    --primary-soft: #e5e7eb;
    --secondary-color: #1f2937;
    --accent-color: #ea580c;
    --accent-soft: #fed7aa;
    --background-color: #ffffff;
    --surface-color: #ffffff;
    --surface-muted: #f5f5f5;
    --text-color: #18181b;
    --muted-text-color: #1f2937;
    --subtle-text-color: rgba(24, 24, 27, 0.45);
    --border-color: #d1d5db;
    --error-color: #ea580c;
    --success-color: #111827;
    --shadow-soft: 0 2px 10px rgba(24, 24, 27, 0.08);
    --shadow-elevated: 0 4px 20px rgba(24, 24, 27, 0.12);
    /* alias for shared templates */
    --color-base-bg: #ffffff;
    --color-surface-muted: #f5f5f5;
    --color-surface-raised: #f9fafb;
    --color-primary: #18181b;
    --color-primary-strong: #111827;
    --color-primary-soft: #e5e7eb;
    --color-accent: #ea580c;
    --color-accent-hover: #c2410c;
    --color-accent-soft: #fed7aa;
    --color-text-primary: #18181b;
    --color-text-secondary: #1f2937;
    --color-text-tertiary: #4b5563;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding-top: 80px; /* Space for fixed navbar */
}

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

h1, h2, h3 {
    color: var(--secondary-color);
    font-weight: 600;
}

/* --- Navbar --- */
.navbar {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 20px;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav-links a:not(.btn-primary),
.nav-links .user-menu-btn {
    text-decoration: none;
    color: var(--muted-text-color);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links .user-menu-btn {
    font: inherit;
}

.nav-links .nav-feature {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-right: 6px;
}

.nav-feature__badge {
    color: #ef4444;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

.nav-feature:hover .nav-feature__badge,
.nav-feature:focus-visible .nav-feature__badge {
    opacity: 1;
    transform: translateY(-6px);
}

.nav-links a:hover,
.nav-links .user-menu-btn:hover {
    color: var(--primary-color);
}

.nav-links .btn-primary {
    color: #fff !important;
}

.nav-links .btn-primary:hover {
    color: #fff !important;
}

/* --- Buttons --- */
.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-strong);
    transform: translateY(-1px);
}

.btn-recharge {
    padding: 8px 18px;
    border-radius: 20px;
    background: var(--primary-color);
    color: white !important;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95em;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-recharge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.28);
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--secondary-color);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--surface-muted);
}

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

input[type="text"], input[type="email"], input[type="password"], textarea, select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.25);
}

.input-large, .textarea-large, .select-large {
    font-size: 1.1rem;
    padding: 15px;
}

/* --- Page Specific --- */
.auth-container {
    max-width: 450px;
    margin: 40px auto;
    padding: 40px;
    background-color: var(--surface-color);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.hero-section {
    text-align: center;
    padding: 80px 0;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.detect-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* --- Components --- */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.user-menu-btn {
    display: inline;
    padding: 0;
    border: none;
    background: none;
    color: var(--muted-text-color);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.2;
    margin: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-menu-btn:hover {
    color: var(--primary-color);
}

.user-menu-btn:focus {
    outline: none;
    color: var(--primary-color);
}

.dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 10px;
    background-color: var(--surface-color);
    border-radius: 5px;
    box-shadow: var(--shadow-elevated);
    min-width: 160px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.user-menu .dropdown a,
.user-menu .dropdown button {
    padding: 10px 16px;
    background: none;
    border: none;
    border-radius: 0;
    color: var(--muted-text-color);
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    display: block;
    width: 100%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.user-menu .dropdown a:hover,
.user-menu .dropdown button:hover {
    background-color: rgba(15, 23, 42, 0.08);
    color: var(--primary-color);
}

.detect-input .actions {
    margin-top: 16px;
}

.detect-input .actions .btn-primary[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.detect-result .detect-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    color: var(--muted-text-color);
    font-size: 0.95rem;
}

.detect-result .detect-status .credits-info {
    color: var(--primary-color);
    font-weight: 600;
}

.error-message {
    background-color: var(--accent-soft);
    color: var(--accent-color);
    padding: 15px;
    border: 1px solid var(--accent-soft);
    border-radius: 5px;
    margin-bottom: 20px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .nav-links {
        display: none; /* Simple solution for mobile, can be improved with a hamburger menu */
    }
    .detect-layout {
        grid-template-columns: 1fr;
    }
}
