/* Theme Variables (light mode defaults) */
:root {
    /* Dark-blue accents for light mode */
    --primary-gradient: linear-gradient(135deg, #062b59 0%, #0f4ca8 100%);
    --primary-color: #0b3d91; /* deep navy */
    --primary-dark: #062645;
    --secondary-color: #0f66c3;
    --success-color: #51cf66;
    --danger-color: #ff6b6b;
    --warning-color: #ffd93d;
    --info-color: #4ecdc4;

    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #0b2540; /* dark text tuned for navy accents */
    --text-secondary: #475b7a;
    --text-tertiary: #7a8aa6;
    --border-color: #e6f0ff; /* subtle very-light blue */
    --shadow-color: rgba(4, 18, 40, 0.06);
    --shadow-color-dark: rgba(4, 18, 40, 0.12);
    --accent-light-blue: #dbeeff; /* used for patient form thin border */
}

body.dark-theme {
    /* Professional dark blue theme */
    --primary-gradient: linear-gradient(135deg, #062b59 0%, #0f4ca8 100%);
    --primary-color: #0b3d91; /* deep navy */
    --primary-dark: #062645;
    --secondary-color: #0f66c3; /* brighter blue */
    --success-color: #2ecc71;
    --danger-color: #ff6b6b;
    --warning-color: #ffd166;
    --info-color: #4fc3ff;

    --bg-primary: #041028; /* dark navy background */
    --bg-secondary: #072444; /* slightly lighter for panels */
    --text-primary: #e6f2ff; /* pale blue text */
    --text-secondary: #bcd8ff;
    --text-tertiary: #89aef8;
    --border-color: #15314d;
    --shadow-color: rgba(2, 8, 23, 0.6);
    --shadow-color-dark: rgba(0, 0, 0, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Notification Banner */
.notification-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 25px 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
    z-index: 10000 !important;
    max-width: 650px;
    width: 95%;
    animation: slideDown 0.4s ease-out;
    border-top: 5px solid var(--primary-color);
}

.notification-banner.positive {
    border-left: 8px solid var(--success-color);
    background: linear-gradient(135deg, rgba(46,204,113,0.04) 0%, var(--bg-secondary) 100%);
}

.notification-banner.negative {
    border-left: 8px solid var(--danger-color);
    background: linear-gradient(135deg, rgba(255,107,107,0.03) 0%, var(--bg-secondary) 100%);
}

.notification-banner.error {
    border-left: 8px solid var(--danger-color);
    background: linear-gradient(135deg, rgba(255,107,107,0.03) 0%, var(--bg-secondary) 100%);
}

.notification-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.notification-text h3 {
    margin: 0 0 5px 0;
    font-size: 1.2em;
    color: #333;
}

.notification-text p {
    margin: 5px 0;
    color: #666;
    font-size: 0.95em;
}

.notification-text strong {
    color: #333;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
    padding: 0;
    min-width: 30px;
    text-align: right;
}

.notification-close:hover {
    color: #333;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.page {
    display: block;
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: 15px;
    box-shadow: 0 20px 60px var(--shadow-color-dark);
    overflow: hidden;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.page-header {
    background: var(--primary-gradient);
    color: white;
    padding: 40px 20px;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.page-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.page-header p {
    font-size: 1.2em;
    opacity: 0.9;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.user-info span {
    font-size: 1em;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid white;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.page-content {
    padding: 40px 20px;
}

.page-footer {
    background: var(--bg-secondary);
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9em;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Form Styles */
.form-section {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 6px 20px var(--shadow-color);
    margin-bottom: 30px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.2s ease;
    border: 1px solid rgba(0,0,0,0.06);
}

.form-section h2 {
    color: var(--text-primary);
    margin-bottom: 25px;
    font-size: 1.8em;
}

/* Make patient information form border more visible */
.form-section.patient-info {
    /* thin, light-blue outline to highlight patient info without heavy visuals */
    border: 1px solid var(--accent-light-blue);
    box-shadow: 0 10px 24px var(--shadow-color-dark);
}

/* On smaller screens keep the outline but reduce shadows and spacing */
@media (max-width: 600px) {
    .form-section.patient-info {
        border: 1px solid var(--accent-light-blue);
        box-shadow: 0 6px 12px rgba(0,0,0,0.06);
    }
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(15, 102, 195, 0.35);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Button Styles */
.submit-btn, .reset-btn, .secondary-btn, .danger-btn, .history-btn, .back-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.submit-btn {
    background: var(--primary-gradient);
    color: white;
    width: 100%;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 25px rgba(15, 102, 195, 0.35);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.reset-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    margin-top: 10px;
    width: 100%;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.reset-btn:hover {
    background: var(--border-color);
}

.button-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.secondary-btn, .danger-btn, .history-btn, .back-btn {
    margin: 5px;
}

.secondary-btn {
    background: var(--primary-color);
    color: white;
}

.secondary-btn:hover {
    background: var(--primary-dark);
}

.danger-btn {
    background: #ff6b6b;
    color: white;
}

.danger-btn:hover {
    background: #ee5a52;
}

.history-btn {
    background: var(--info-color);
    color: white;
}

.history-btn:hover {
    background: #2fa9e6;
}

.back-btn {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.back-btn:hover {
    background: rgba(15, 102, 195, 0.08);
}

/* Welcome Page */
.welcome-content {
    padding: 60px 20px;
}

.welcome-section {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.welcome-section h2 {
    font-size: 2.5em;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.welcome-section p {
    font-size: 1.1em;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 40px;
}

.welcome-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 60px;
}

.welcome-btn {
    display: inline-block;
    padding: 15px 40px;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
}

.signup-welcome-btn {
    background: var(--primary-gradient);
}

.signup-welcome-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(15, 102, 195, 0.35);
}

.login-welcome-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.login-welcome-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(245, 87, 108, 0.4);
}

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

.feature-card {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px var(--shadow-color-dark);
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Result Display */
.result-section, .error-section {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 25px var(--shadow-color-dark);
    margin-top: 30px;
    border-left: 5px solid var(--primary-color);
}

.result-section[style*="display: block"],
.error-section[style*="display: block"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    animation: slideInUp 0.4s ease-out;
}

.result-header, .error-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.result-header h2, .error-header h2 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.5em;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px 10px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    color: var(--text-primary);
    transform: scale(1.2);
}

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

.result-section h2, .error-section h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
}

.result-card {
    padding: 20px;
    border-radius: 8px;
    background: var(--bg-secondary);
    transition: background-color 0.3s ease;
}

.result-status {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    color: white;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 1.2em;
}

.result-status h3 {
    margin: 0;
    color: white;
}

.result-status.positive {
    background: #ff6b6b;
}

.result-status.negative {
    background: #51cf66;
}

.result-details {
    color: var(--text-primary);
    line-height: 1.8;
}

.result-details p {
    margin-bottom: 10px;
    color: var(--text-primary);
}

.result-details strong {
    color: var(--text-primary);
    font-weight: 600;
}

.result-details span {
    color: var(--primary-color);
    font-weight: 500;
}

.error-card {
    background: #ffe5e5;
    border: 1px solid #ff6b6b;
    color: #d32f2f;
    padding: 20px;
    border-radius: 8px;
}

/* Prediction Content Layout */
.prediction-content {
    display: block;
}

.prediction-main {
    flex: 1;
}

.info-panel {
    background: var(--bg-primary);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
    height: fit-content;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.info-panel h3 {
    color: var(--primary-color);
    margin-top: 20px;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.info-panel h3:first-child {
    margin-top: 0;
}

.model-info p, .reference-values p {
    font-size: 0.95em;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
}

.reference-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9em;
}

.reference-item:last-child {
    border-bottom: none;
}

.reference-item strong {
    color: var(--text-primary);
}

.reference-item span {
    color: var(--primary-color);
}

/* History Page */
.history-content {
    padding: 20px 0;
}

.history-section {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px var(--shadow-color);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.history-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.history-container {
    display: grid;
    gap: 15px;
}

.history-item {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s ease;
}

.history-item.positive {
    border-left: 5px solid #ff6b6b;
}

.history-item.negative {
    border-left: 5px solid #51cf66;
}

.history-item:hover {
    box-shadow: 0 5px 15px var(--shadow-color);
}

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

.history-datetime {
    display: flex;
    gap: 15px;
    font-size: 0.95em;
    flex-direction: column;
}

.history-date {
    color: var(--primary-color);
    font-weight: 600;
}

.history-time {
    color: var(--text-tertiary);
}

.delete-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: #ee5a52;
    transform: scale(1.05);
}

.history-content {
    color: var(--text-primary);
}

.history-content p {
    margin-bottom: 8px;
}

.history-parameters {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.history-parameters h4 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 0.95em;
}

.parameters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.param-item {
    background: rgba(11, 61, 145, 0.08);
    padding: 10px 12px;
    border-radius: 5px;
    font-size: 0.9em;
    border-left: 3px solid var(--primary-color);
}

.param-item strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 3px;
}

.no-history {
    text-align: center;
    color: var(--text-tertiary);
    padding: 40px;
    font-style: italic;
}

/* Auth Messages */
.auth-error {
    background: #ffe5e5;
    border: 1px solid #ff6b6b;
    color: #d32f2f;
    padding: 12px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.auth-success {
    background: #e8f5e9;
    border: 1px solid #51cf66;
    color: #2e7d32;
    padding: 12px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
}

.auth-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

.wide-section {
    max-width: 500px;
    margin: 0 auto;
}

/* Field Suggestions Dropdown */
.field-suggestions {
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 10px 30px var(--shadow-color-dark);
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
    max-width: 300px;
}

.field-suggestions div {
    padding: 12px 16px;
    cursor: pointer;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    font-size: 0.95em;
}

.field-suggestions div:last-child {
    border-bottom: none;
}

.field-suggestions div:hover {
    background: linear-gradient(90deg, rgba(15,102,195,0.06) 0%, rgba(11,61,145,0.04) 100%);
    padding-left: 20px;
    color: var(--text-primary);
}

/* Result Display Section */
.result-display {
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
    box-shadow: 0 8px 25px var(--shadow-color-dark);
    animation: slideInUp 0.4s ease-out;
}

.result-display-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.result-display-header h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.3em;
}

.result-display-time {
    color: var(--text-tertiary);
    font-size: 0.9em;
}

/* Landing page hero additions */
.hero-section {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 36px;
    align-items: center;
    padding: 56px 40px;
}

.hero-title {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-weight: 800;
}

.hero-subtitle { color: var(--text-secondary); margin-bottom: 18px; }
.hero-lead { color: var(--text-tertiary); max-width: 60ch; margin-bottom: 20px; }

.cta-primary { display:inline-block; text-decoration:none; padding:12px 22px; border-radius:10px; background:var(--primary-gradient); color:#fff; font-weight:700; }
.cta-outline { display:inline-block; text-decoration:none; padding:10px 20px; border-radius:10px; border:2px solid rgba(11,61,145,0.12); background:#ffffff; color:var(--primary-color); font-weight:700; box-shadow:0 8px 20px rgba(11,61,145,0.06); transition: transform 180ms ease, box-shadow 180ms ease; }
.cta-outline:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(11,61,145,0.09); }

.hero-image { display:flex; align-items:center; justify-content:center; }
.hero-card { width:100%; border-radius:14px; overflow:hidden; box-shadow:0 18px 40px rgba(4,18,40,0.06); background: linear-gradient(180deg,#fff,#f7fbff); }

@media (max-width: 980px) {
    .hero-section { grid-template-columns: 1fr; padding: 28px 18px; }
    .hero-image { order:-1; margin-bottom:18px; }
}

@keyframes float {
    0% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0); }
}

.hero-image img { width:100%; display:block; }


.result-status-box {
    background: linear-gradient(135deg, rgba(15,102,195,0.04) 0%, rgba(11,61,145,0.02) 100%);
    border-left: 5px solid var(--primary-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.result-status-box h2 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.4em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-status-box h2.positive {
    color: #ff6b6b;
    border-left-color: #ff6b6b;
}

.result-status-box h2.negative {
    color: #51cf66;
    border-left-color: #51cf66;
}

.result-display-content {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.result-row:last-child {
    border-bottom: none;
}

.result-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95em;
}

.result-output {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95em;
}

.result-display-note {
    background: linear-gradient(135deg, rgba(15,102,195,0.04) 0%, rgba(11,61,145,0.03) 100%);
    border: 1px solid rgba(15,102,195,0.14);
    border-radius: 8px;
    padding: 12px 15px;
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.5;
}

.result-display-note strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2em;
    }
    
    .prediction-content {
        grid-template-columns: 1fr;
    }
    
    .info-panel {
        order: 2;
    }
    
    .prediction-main {
        order: 1;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
    
    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .welcome-buttons {
        flex-direction: column;
    }
    
    .welcome-btn {
        width: 100%;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .history-datetime {
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 30px 15px;
    }
    
    .page-header h1 {
        font-size: 1.5em;
    }
    
    .page-content {
        padding: 20px 10px;
    }
    
    .form-section {
        padding: 20px 15px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        grid-template-columns: 1fr;
    }
}
