:root {
    --primary-color: #2563eb;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --card-bg: #ffffff;
    --nav-bg: #1e293b;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Responsive Navigation */
nav {
    background: var(--nav-bg);
    color: white;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

/* Container that adjusts width based on screen size */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 10px;
}

/* Modern Card Component for every page */
.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Responsive Grid for Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile: 1 column */
    gap: 20px;
}

/* Tablet View */
@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns */
    }
}

/* Desktop View */
@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 columns */
    }
}

button, .btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover { background-color: #1d4ed8; }

/* Base style for all messages */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    text-align: center;
}

/* Green for success */
.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

/* Red for error */
.alert-error, .alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

/* Blue for info */
.alert-info {
    background-color: #e0f2fe;
    color: #075985;
    border-color: #bae6fd;
}

/* Account dropdown in top nav */
.nav-account-dropdown {
    position: relative;
    display: inline-block;
}

.nav-account-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 0.8rem;
}

.nav-account-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 6px 0;
    color: var(--text-color);
}

.nav-account-menu[hidden] {
    display: none !important;
}

.nav-account-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
}

.nav-account-menu-item:hover {
    background: #f1f5f9;
}

.nav-account-menu-item--button {
    border-radius: 0;
    color: var(--text-color);
    background: transparent;
    padding: 8px 14px;
    font-size: 0.9rem;
}

.nav-account-menu-item--button:hover {
    background: #f1f5f9;
    color: var(--text-color);
}

.nav-account-menu-divider {
    height: 1px;
    margin: 6px 10px;
    background: #e2e8f0;
}

.nav-account-logout-form {
    margin: 0;
}

.nav-unread-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
}

.nav-unread-dot--trigger {
    position: absolute;
    top: 2px;
    right: 2px;
}

.nav-unread-dot.is-hidden {
    display: none;
}

/* Notifications page */
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notification-list-link {
    text-decoration: none;
    color: inherit;
    display: block;
    flex: 1;
    min-width: 0;
}

.notification-list-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.notification-item--list:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.notification-delete-form {
    margin: 0;
    flex-shrink: 0;
}

.notification-delete-btn {
    background: transparent;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    cursor: pointer;
}

.notification-delete-btn:hover {
    background: #fef2f2;
    color: #991b1b;
}

.notification-restore-form {
    margin: 0;
    flex-shrink: 0;
}

.notification-restore-btn {
    background: transparent;
    color: #166534;
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    cursor: pointer;
}

.notification-restore-btn:hover {
    background: #f0fdf4;
    color: #14532d;
}

.notification-list-link--static {
    cursor: default;
}

.notification-trash-hint {
    margin: 0.5rem 0 0;
    color: #64748b;
    font-size: 0.85rem;
}

.notification-detail-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.notification-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    background: #ffffff;
}

.notification-item--list {
    margin: 0;
    position: relative;
    padding-bottom: 1.75rem;
    transition: border-color 0.15s, background 0.15s;
}

.notification-item-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 0.5rem;
}

.notification-item-title {
    margin: 0;
    font-size: 1.05rem;
}

.notification-detail-title {
    margin: 0;
    font-size: 1.35rem;
}

.notification-item-meta {
    color: #64748b;
    font-size: 0.85rem;
}

.notification-item-reason {
    display: inline-block;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    color: #475569;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 2px 8px;
}

.notification-item-content {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    overflow-x: auto;
}

.notifications-empty {
    color: #64748b;
}

.notification-back {
    margin: 0 0 12px;
}

.notification-back a {
    color: #2563eb;
    text-decoration: none;
    font-size: 0.95rem;
}

.notification-back a:hover {
    text-decoration: underline;
}

.notification-summary {
    margin: 0 0 1rem;
    color: #334155;
}

.notification-location-path {
    margin: 0 0 1rem;
    color: #475569;
}

.notification-error-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification-error-card {
    border: 1px solid #fecaca;
    background: #fff7f7;
    border-radius: 8px;
    padding: 12px 14px;
}

.notification-error-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.notification-error-card-header code {
    font-size: 0.9rem;
    background: #fee2e2;
    padding: 2px 6px;
    border-radius: 4px;
}

.notification-error-archetype {
    font-size: 0.8rem;
    color: #64748b;
}

.notification-error-issue {
    font-size: 0.85rem;
    font-weight: 600;
    color: #9f1239;
    margin-bottom: 4px;
    text-transform: capitalize;
}

.notification-error-message {
    margin: 0;
    color: #7f1d1d;
    line-height: 1.45;
}

.notification-plain-list {
    margin: 0;
    padding-left: 1.2rem;
    color: #1e293b;
}

.notification-plain-list li {
    margin-bottom: 0.35rem;
}

.notification-section-heading {
    margin: 1.25rem 0 0.75rem;
    font-size: 1.05rem;
}

.notification-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px 20px;
    margin: 0;
}

.notification-meta-grid dt {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    margin: 0 0 2px;
}

.notification-meta-grid dd {
    margin: 0;
    color: #1e293b;
}

.notification-kv-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.notification-kv-list li {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.notification-kv-list li:last-child {
    border-bottom: none;
}

.notification-kv-key {
    min-width: 120px;
    color: #475569;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
}

.notification-kv-value {
    color: #1e293b;
    word-break: break-word;
}

.notification-attempts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notification-attempt {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
    background: #f8fafc;
}

.notification-attempt.is-fail {
    border-color: #fecaca;
    background: #fff7f7;
}

.notification-attempt.is-ok {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.notification-attempt-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.notification-attempt-status {
    font-size: 0.85rem;
    color: #64748b;
}

.notification-error-list {
    margin: 0 0 8px;
    padding-left: 1.1rem;
    color: #991b1b;
}

.notification-error-list--primary {
    margin: 0;
    color: #7f1d1d;
    line-height: 1.5;
}

.notification-error-list code {
    font-size: 0.85rem;
    background: #fee2e2;
    padding: 1px 5px;
    border-radius: 4px;
}

.notification-id-hint {
    color: #94a3b8;
    font-size: 0.85rem;
}

.notification-attempts-details > summary {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.notification-attempts-details .notification-attempts {
    margin-top: 0.75rem;
}

.notification-nested-details {
    margin-top: 6px;
    font-size: 0.9rem;
}

.notification-nested-details summary {
    cursor: pointer;
    color: #475569;
}

/* Yellow for warning */
.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

/* Dashboard: My Courses + unread notifications */
.dashboard-courses-card,
.dashboard-notifications-card,
.dashboard-manual-grading-card,
.dashboard-active-retakes-card,
.dashboard-focus-unlocks-card {
    grid-column: 1 / -1;
}

.dashboard-course-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 0.75rem;
}

.dashboard-course-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px 20px;
    padding: 1rem 0;
    border-top: 1px solid #e2e8f0;
}

.dashboard-course-row:first-child {
    border-top: none;
    padding-top: 0;
}

.dashboard-course-main {
    flex: 1 1 240px;
    min-width: 0;
}

.dashboard-course-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.dashboard-course-name a {
    color: var(--text-color);
    text-decoration: none;
}

.dashboard-course-name a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.dashboard-course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    color: #64748b;
    font-size: 0.92rem;
}

.dashboard-course-status {
    font-weight: 600;
    color: #334155;
}

.dashboard-course-row--closed .dashboard-course-status {
    color: #9a3412;
}

.dashboard-historic-grades-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.dashboard-historic-grades-header h2 {
    margin: 0;
}

.dashboard-course-actions {
    flex: 0 0 auto;
}

.dashboard-course-actions .btn {
    display: inline-block;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 14px;
}

.dashboard-manual-grading-count,
.dashboard-course-actions .dashboard-manual-grading-link {
    color: #b91c1c;
    font-weight: 600;
}

.dashboard-course-actions .dashboard-manual-grading-link {
    border-color: #fecaca;
    background: #fef2f2;
}

.dashboard-course-actions .dashboard-manual-grading-link:hover {
    background: #fee2e2;
}

.dashboard-active-retake-count,
.dashboard-course-actions .dashboard-active-retake-link {
    color: #92400e;
    font-weight: 600;
}

.dashboard-course-actions .dashboard-active-retake-link {
    border-color: #fde68a;
    background: #fffbeb;
}

.dashboard-course-actions .dashboard-active-retake-link:hover {
    background: #fef3c7;
}

.dashboard-focus-unlock-status,
.dashboard-course-actions .dashboard-focus-unlock-link {
    color: #991b1b;
    font-weight: 600;
}

.dashboard-course-actions .dashboard-focus-unlock-link {
    border-color: #fecaca;
    background: #fef2f2;
}

.dashboard-course-actions .dashboard-focus-unlock-link:hover {
    background: #fee2e2;
}

.dashboard-empty {
    color: #64748b;
    margin: 0.5rem 0 0;
}

.dashboard-notification-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
}

.dashboard-notification-item {
    border-top: 1px solid #e2e8f0;
}

.dashboard-notification-item:first-child {
    border-top: none;
}

.dashboard-notification-link {
    display: block;
    padding: 0.85rem 0;
    color: inherit;
    text-decoration: none;
}

.dashboard-notification-link:hover .dashboard-notification-title {
    color: var(--primary-color);
    text-decoration: underline;
}

.dashboard-notification-title {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notification-status-tag {
    position: absolute;
    right: 1rem;
    bottom: 0.65rem;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: lowercase;
}

.notification-status-tag--read {
    color: #166534;
    background: #dcfce7;
    border: 1px solid #86efac;
}

.notification-status-tag--unread {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fca5a5;
}

.notification-status-tag--trashed {
    position: static;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
}

.notification-trash-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 1.25rem;
}

.notifications-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.notifications-header-row h1 {
    margin-bottom: 0.35rem;
}

.notifications-header-row p {
    margin: 0;
}

.notifications-mark-all-form {
    margin: 0;
    flex-shrink: 0;
}

.notifications-load-more-wrap,
.notifications-bulk-delete-wrap {
    display: flex;
    justify-content: center;
    margin: 1.25rem 0 0.5rem;
}

.notification-delete-all-read-btn {
    background: #b91c1c;
}

.notification-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
}

.notification-confirm-overlay[hidden] {
    display: none !important;
}

.notification-confirm-modal {
    background: #fff;
    border-radius: 10px;
    max-width: 520px;
    width: 100%;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.notification-confirm-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 20px;
}

.notification-empty-trash-form {
    margin: 0;
}

.notification-empty-trash-btn {
    background: #b91c1c;
}

.notification-trash-section {
    margin-top: 1rem;
}

.notification-trash-note {
    color: #64748b;
    margin: 0;
    font-size: 0.92rem;
}

.notification-item--trashed {
    opacity: 0.92;
    background: #f8fafc;
}

.dashboard-notification-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.85rem;
    color: #64748b;
    font-size: 0.88rem;
}

.dashboard-notification-reason {
    background: #f1f5f9;
    border-radius: 4px;
    padding: 1px 8px;
}

.dashboard-notification-footer {
    margin: 0.75rem 0 0;
    font-size: 0.92rem;
}

.dashboard-notification-footer a {
    color: var(--primary-color);
}
