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

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}

/* Container for consistent width */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(10, 22, 40, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(0, 120, 255, 0.18);
    color: white;
    padding: 0.5rem 0;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.logo-img {
    height: 28px;
    width: auto;
    display: block;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.logo-link:hover .logo-img {
    opacity: 0.82;
}


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

.nav a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.2s;
    position: relative;
    padding-bottom: 3px;
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1.5px;
    background: linear-gradient(90deg, #0078ff, #00c8ff);
    border-radius: 1px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.nav a:hover {
    color: #60d0ff;
}

.nav a:hover::after {
    transform: scaleX(1);
}

/* Exempt icon-only links (bell, logout) from underline indicator */
.nav a.notif-bell::after,
.nav a.btn::after {
    display: none;
}

.nav a.notif-bell {
    color: rgba(255, 255, 255, 0.75);
}

.nav a.notif-bell:hover {
    color: #60d0ff;
}

.nav .btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}

/* Button styles */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.2s;
    cursor: pointer;
}

.btn-primary {
    background-color: #28a745;
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, 0.32);
    color: rgba(255, 255, 255, 0.85);
    border-radius: 6px;
}

.btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.7);
    color: white;
    background: rgba(255, 255, 255, 0.08);
    transform: none;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #0052cc 0%, #007bff 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero .description {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto 2rem;
}

.cta-buttons .btn {
    margin: 0 0.5rem;
}

/* Features Section */
.features {
    padding: 3rem 0;
    background-color: var(--bg-primary);
}

.features h3 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #003087;
}

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

.feature-item {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s;
}

.feature-item:hover {
    transform: translateY(-5px);
}

.feature-item h4 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #0052cc;
}

.feature-item p {
    font-size: 1rem;
    color: #555;
}

/* Footer */
.footer {
    background-color: #003087;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 2rem;
}

.footer p {
    font-size: 0.9rem;
}

/* Form styles */
.login-form {
    max-width: 400px;
    margin: 20px auto;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Image detail styles */
.back-link {
    display: inline-block;
    margin: 1rem 0;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

.plot-container {
    display: inline-block;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    margin-bottom: 1rem;
}

#dvh-chart {
    border: 2px dashed red;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .nav {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav a {
        margin: 0;
    }

    .nav .btn {
        width: 100%;
        max-width: 200px;
        text-align: center;
    }

    .hero h2 {
        font-size: 2rem;
    }

    .hero .description {
        font-size: 1rem;
    }

    .cta-buttons .btn {
        display: block;
        margin: 0.5rem auto;
        max-width: 200px;
    }
}

#viewer-grid>div {
    position: relative;
    z-index: 1;
}

#viewer-grid input[type=range],
#viewer-grid label {
    position: relative;
    z-index: 2;
}

.grid line {
    stroke: #ccc;
    stroke-opacity: 0.7;
    shape-rendering: crispEdges;
}

.grid path {
    display: none;
}

#contour {
    max-height: 400px;
    overflow-y: auto;
}

.dose-stat-row:hover {
    background-color: #f0f8ff;
    cursor: pointer;
}

.legend-item:hover {
    background-color: #f5f5f5;
    border-radius: 4px;
}

/* =====================================================================
   Apple-style toast notifications  (js/notifications.js)
   ===================================================================== */

:root {
    --ca-toast-success: #34c759;
    --ca-toast-error:   #ff3b30;
    --ca-toast-warning: #ff9500;
    --ca-toast-info:    #007aff;
    --ca-toast-debug:   #8e8e93;
    --ca-toast-bg:      rgba(255, 255, 255, 0.96);
    --ca-toast-title:   var(--light-text-primary, #1c1c1e);
    --ca-toast-body:    var(--light-text-secondary, #636366);
    --ca-toast-shadow:  0 4px 24px rgba(0, 0, 0, 0.16), 0 1px 4px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"],
html[data-bs-theme="dark"] {
    --ca-toast-bg:    rgba(44, 44, 46, 0.97);
    --ca-toast-title: var(--dark-text-primary, #f2f2f7);
    --ca-toast-body:  var(--dark-text-secondary, #aeaeb2);
}

#ca-toast-container {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 10500;           /* above Bootstrap modals (1055) and nav (1000) */
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
    width: calc(100vw - 32px);
    pointer-events: none;     /* clicks pass through the gap between toasts */
}

.ca-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 14px 14px 16px;
    background: var(--ca-toast-bg);
    border-radius: 14px;
    box-shadow: var(--ca-toast-shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    pointer-events: all;

    /* Start offscreen-left, invisible */
    transform: translateX(calc(-100% - 24px));
    opacity: 0;
    transition: transform 0.38s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity   0.25s ease;
}

.ca-toast--visible {
    transform: translateX(0);
    opacity: 1;
}

.ca-toast--hiding {
    animation: ca-toast-out 0.28s ease-in forwards;
}

@keyframes ca-toast-out {
    to { transform: translateX(calc(-100% - 24px)); opacity: 0; }
}

.ca-toast__icon {
    font-size: 1.15rem;
    flex-shrink: 0;
    margin-top: 1px;
    line-height: 1;
}

.ca-toast__body {
    flex: 1;
    min-width: 0;
}

.ca-toast__title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--ca-toast-title);
    margin-bottom: 2px;
    line-height: 1.3;
}

.ca-toast__message {
    font-size: 0.8125rem;
    color: var(--ca-toast-body);
    line-height: 1.4;
    word-break: break-word;
}

.ca-toast__close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 0.75rem;
    color: var(--ca-toast-body);
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.15s ease;
    margin-top: 1px;
}

.ca-toast__close:hover {
    opacity: 1;
}

@media (max-width: 480px) {
    #ca-toast-container {
        top: 8px;
        left: 8px;
        right: 8px;
        max-width: 100%;
        width: auto;
    }
}

/* =====================================================================
   Notification bell (nav bar)
   ===================================================================== */

.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: inherit;
    text-decoration: none;
    transition: background 0.15s ease;
}

.notif-bell:hover {
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
}

html[data-theme="dark"] .notif-bell:hover,
html[data-bs-theme="dark"] .notif-bell:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notif-bell i {
    font-size: 1.1rem;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ff3b30;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}