/* static/style.css */

/* --- 1. Variables (Default / Light Mode) --- */
:root {
    --primary: #4F46E5;
    --primary-hover: #4338ca;
    --background: #F3F4F6;
    --card-bg: rgba(255, 255, 255, 0.85); 
    --input-bg: #ffffff;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --radius: 16px;
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    --success-bg: #ECFDF5;
    --success-border: #10B981;
    --success-text-head: #065F46;
    --success-text-body: #047857;
    
    --danger-bg: #FEF2F2;
    --danger-border: #EF4444;
    --danger-text-head: #991B1B;
    --danger-text-body: #7F1D1D;

    /* Info/Reference Blue */
    --info-bg: #EFF6FF;
    --info-border: #3B82F6;
    --info-text: #1E40AF;

    /* Only needed for the favicon now */
    --svg-fill-dark: #111827; 
}

/* --- 2. Dark Mode Overrides --- */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #6366F1; 
        --primary-hover: #818CF8;
        --background: #0f172a;
        --card-bg: rgba(30, 41, 59, 0.7);
        --input-bg: #1e293b;
        --text-main: #F3F4F6;
        --text-muted: #9CA3AF;
        --border: #374151;
        
        --success-bg: rgba(6, 95, 70, 0.3);
        --success-border: #059669;
        --success-text-head: #D1FAE5;
        --success-text-body: #6EE7B7;
        
        --danger-bg: rgba(153, 27, 27, 0.3);
        --danger-border: #DC2626;
        --danger-text-head: #FEE2E2;
        --danger-text-body: #FCA5A5;

        /* Dark Info Blue */
        --info-bg: rgba(59, 130, 246, 0.2);
        --info-border: #3B82F6;
        --info-text: #93C5FD;

        --svg-fill-dark: #E5E7EB;
    }
}

/* --- 3. Global Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--background);
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(245, 158, 11, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.main-wrapper {
    width: 100%;
    max-width: 900px;
}

/* --- 4. Container --- */
.container {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: background 0.3s ease;
}

@media (max-width: 640px) {
    .container {
        padding: 1.5rem;
    }
}

/* --- 5. Header (UPDATED) --- */
.header-section {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* NEW: Professional Hero Icon container */
.hero-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 90px;
    height: 90px;
    margin-bottom: 1.5rem;
    /* Professional gradient background */
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    /* Organic blob shape */
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    box-shadow: 0 10px 20px -10px rgba(79, 70, 229, 0.5);
    /* Subtle breathing animation */
    animation: blobPulse 8s ease-in-out infinite alternate;
}

.hero-icon {
    width: 42px;
    height: 42px;
    color: white; /* Icon is always white against the colored blob */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

@keyframes blobPulse {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: scale(1); }
    100% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; transform: scale(1.05); }
}

.header-section h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.header-section p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* --- Toolbar --- */
.toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.secondary-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background-color: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-button:hover {
    color: var(--primary);
    border-color: var(--primary);
    background-color: rgba(79, 70, 229, 0.05);
}

/* --- Reference Card --- */
.reference-card {
    background-color: var(--info-bg);
    border-left: 4px solid var(--info-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideDown 0.3s ease-out;
}

.reference-icon {
    color: var(--info-border);
    display: flex;
    align-items: center;
}

.reference-content h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.reference-content p {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-main);
    margin: 0;
}

/* --- 6. Form Grid & Tooltips --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 2rem;
        row-gap: 1.5rem;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tooltip Styles */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
}

.info-icon {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tooltip-container:hover .info-icon {
    opacity: 1;
    color: var(--primary);
}

.tooltip-text {
    visibility: hidden;
    width: 160px;
    background-color: var(--text-main);
    color: var(--background);
    text-align: center;
    border-radius: 6px;
    padding: 6px 10px;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    pointer-events: none;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--text-main) transparent transparent transparent;
}

/* --- 7. Inputs --- */
input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.2s ease;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* --- 8. Button --- */
.predict-button {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.predict-button:active {
    transform: translateY(0);
}

/* --- 9. Result Box --- */
.result-container {
    margin-top: 2rem;
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-success {
    background-color: var(--success-bg);
    border: 1px solid var(--success-border);
}
.result-success .result-icon {
    background-color: var(--success-border);
    color: white;
}
.result-success h2 { color: var(--success-text-head); }
.result-success p { color: var(--success-text-body); font-weight: 500; }

.result-danger {
    background-color: var(--danger-bg);
    border: 1px solid var(--danger-border);
}
.result-danger .result-icon {
    background-color: var(--danger-border);
    color: white;
}
.result-danger h2 { color: var(--danger-text-head); }
.result-danger p { color: var(--danger-text-body); font-weight: 500; }

.result-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-text h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 2px;
}

/* --- 10. Footer Section --- */
.footer-link {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.footer-link a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-link a:hover {
    color: var(--primary);
    text-decoration: underline;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}