/* Global Styles & Variables */
:root {
    /* Dark Mode Colors */
    --background: #050505;
    /* Deepest Black */
    --foreground: #ffffff;
    --card-background: #0a0a0a;
    /* Slightly lighter black */
    --card-border: #27272a;
    /* Zinc 800 */

    /* Primary Accents - "Cyber" / "Cool" Palette */
    --primary: #6366f1;
    /* Indigo 500 - slightly lighter for dark mode */
    --primary-hover: #818cf8;
    /* Indigo 400 */
    --primary-foreground: #ffffff;

    --accent-text: #38bdf8;
    /* Sky 400 - for cool text highlights */
    --accent-glow: rgba(56, 189, 248, 0.15);

    --secondary: #18181b;
    /* Zinc 900 */
    --secondary-foreground: #e4e4e7;
    --muted: #a1a1aa;
    /* Zinc 400 */
    --border: #27272a;

    /* Radii */
    --radius: 0.75rem;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    /* Dark "Glow" background spots */
    background-image:
        radial-gradient(circle at 15% 10%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.08) 0%, transparent 40%);
    color: var(--foreground);
    margin: 0;
    padding: 2rem 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    max-width: 600px;
    width: 90%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 0.5rem 0;
    /* Cool Gradient Text: Blue to Purple */
    background: linear-gradient(135deg, #60a5fa 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 2em rgba(96, 165, 250, 0.3));
}

header p {
    color: var(--muted);
    font-size: 0.95rem;
    margin: 0;
}

/* Unit Toggle */
.unit-toggle {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    width: 100%;
}

.unit-toggle-inner {
    background-color: var(--secondary);
    /* Dark container */
    border: 1px solid var(--border);
    border-radius: 9999px;
    padding: 0.3rem;
    display: inline-flex;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.unit-btn {
    border: none;
    background: transparent;
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.unit-btn.active {
    background: var(--card-background);
    /* Black button on dark grey bg */
    color: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Card Styling */
.card {
    width: 100%;
    background-color: var(--card-background);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
    /* Strong shadow for depth */
    padding: 2.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

/* 
   TABS NAVIGATION 
   Style: Buttons that look like clickable tiles/cards to be Very Obvious 
*/
.tabs {
    display: flex;
    background-color: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 0.4rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    gap: 0.5rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
    padding: 0.6rem 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-align: center;
}

/* Active Tab: High contrast background */
.tab-btn.active {
    background-color: #27272a;
    /* Slightly lighter zinc */
    color: #fff;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    /* Slight color accent on text or border? Let's use text accent */
    color: var(--accent-text);
    border: 1px solid rgba(56, 189, 248, 0.2);
    /* Subtle blue border */
}

.tab-btn:hover:not(.active) {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.03);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Forms */
label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    margin-top: 1.5rem;
    color: var(--muted);
    /* Muted labels so text pops */
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

label:first-child {
    margin-top: 0;
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    /* Dark inputs */
    background-color: #000000;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: #fff;
    transition: all 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-text);
    /* Blue focus border */
    box-shadow: 0 0 0 1px var(--accent-text), 0 0 15px var(--accent-glow);
    /* Glowing focus */
}

/* Dropdown Options - Ensure visibility in dark theme */
select option {
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 8px 12px;
}

select option:hover,
select option:focus,
select option:checked {
    background-color: var(--primary);
    color: #ffffff;
}

select option:disabled {
    color: var(--muted);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    margin-top: 2rem;
    transition: all 0.2s;
    line-height: normal;
}

.btn-primary {
    /* Gradient Button */
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
    /* Glow effect */
}

.btn-secondary {
    background: var(--card-background);
    color: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
}

.btn-secondary:hover {
    background: var(--secondary);
    border-color: var(--muted);
    transform: translateY(-1px);
}

.btn-primary:active,
.btn-secondary:active {
    transform: translateY(0);
}

/* Results Box */
.result-box {
    margin-top: 2rem;
    padding: 1.5rem;
    /* Dark glass effect */
    background: rgba(39, 39, 42, 0.4);
    border-radius: var(--radius);
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
    border: 1px solid var(--border);
    position: relative;
}

.result-box span {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    margin-top: 0.5rem;
    /* Cool neon cyan for results */
    color: var(--accent-text);
    letter-spacing: -0.02em;
    text-shadow: 0 0 20px var(--accent-glow);
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.radio-item input {
    margin: 0;
    width: auto;
    cursor: pointer;
    accent-color: var(--accent-text);
    width: 1.2rem;
    height: 1.2rem;
}

.radio-item label {
    margin: 0;
    font-weight: normal;
    color: #e4e4e7;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}

/* Footer & Logo */
footer {
    margin-top: 3rem;
    padding: 1rem;
    text-align: center;
    color: #a1a1aa;
    /* Lighter for better visibility on dark */
    font-size: 0.8rem;
}

.footer-text {
    margin-top: 0.75rem;
    font-weight: 700;
    /* Bold */
    font-size: 0.9rem;
    /* Slightly larger */
    color: #e4e4e7;
    /* bright text */
    letter-spacing: 0.02em;
}


.logo-wrapper {
    display: inline-block;
    position: relative;
    padding: 3px;
    /* Border width */
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #d946ef 100%);
    /* Blue to Pink gradient */
    box-shadow: 0 0 25px rgba(79, 70, 229, 0.4);
    /* Glow */
}

.logo-wrapper img {
    display: block;
    height: 44px;
    width: auto;
    background-color: white;
    /* Ensure white bg */
    border-radius: 9px;
    /* Slightly inner radius */
    filter: none;
    transition: transform 0.3s;
}

.logo-wrapper:hover img {
    transform: scale(1.02);
}

/* Auth Tooltip */
.tooltip-wrapper {
    position: relative;
    cursor: help;
    display: flex;
    justify-content: center;
    padding-right: 5px;
    /* Align slightly with button edge */
    margin-top: 4px;
}

.tooltip-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    transition: all 0.2s;
}

.tooltip-wrapper:hover .tooltip-icon {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.tooltip-message {
    visibility: hidden;
    opacity: 0;
    width: 200px;
    background-color: rgba(10, 10, 10, 0.95);
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 10px;
    position: absolute;
    z-index: 100;
    top: 25px;
    /* Below the question mark */
    right: 0;
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    font-size: 0.75rem;
    line-height: 1.4;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    transform: translateY(-5px);
    backdrop-filter: blur(4px);
}

.tooltip-wrapper:hover .tooltip-message {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

/* =====================================
   AUTH MODAL STYLES
   ===================================== */

#auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.auth-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.auth-modal-content {
    position: relative;
    background: var(--card-background);
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.auth-modal-close:hover {
    color: #fff;
}

/* Social Buttons */
.auth-social-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.auth-btn-google {
    background: #fff;
    color: #1f1f1f;
}

.auth-btn-google:hover {
    background: #f1f1f1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.auth-btn-apple {
    background: #000;
    color: #fff;
    border-color: #333;
}

.auth-btn-apple:hover {
    background: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.auth-btn-submit {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #fff;
    border: none;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.auth-btn-submit:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Email Form Tabs */
.auth-tabs {
    display: flex;
    background: var(--secondary);
    border-radius: 0.5rem;
    padding: 0.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--card-background);
    color: var(--accent-text);
    border: 1px solid var(--border);
}

.auth-tab:hover:not(.active) {
    color: #fff;
}

/* Auth Panels */
.auth-panel {
    display: none;
}

.auth-panel.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Auth Input */
.auth-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #000;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent-text);
    box-shadow: 0 0 0 1px var(--accent-text), 0 0 15px var(--accent-glow);
}

.auth-input::placeholder {
    color: var(--muted);
}

/* Error/Success Messages */
.auth-error {
    margin-top: 1rem;
    padding: 0;
    text-align: center;
    font-size: 0.8rem;
    color: #ef4444;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.auth-error.show {
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius);
    border: 1px solid rgba(239, 68, 68, 0.3);
    opacity: 1;
    max-height: 100px;
}

.auth-error.show.success {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}