/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #004a99;
    --primary-hover: #003366;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #333;
    --text-muted: #6c757d;
    --background-color: #ffffff;
    --card-background: #ffffff;
    --modal-background: rgba(0,0,0,0.5);
}

/* Dark mode - automatically detected from system preferences */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #4a90e2;
        --primary-hover: #357abd;
        --secondary-color: #8e9aaf;
        --success-color: #52c41a;
        --danger-color: #f5222d;
        --warning-color: #faad14;
        --info-color: #1890ff;
        --light-gray: #1f1f1f;
        --border-color: #434343;
        --text-color: #e0e0e0;
        --text-muted: #a0a0a0;
        --background-color: #121212;
        --card-background: #1e1e1e;
        --modal-background: rgba(0,0,0,0.8);
    }

    body {
        background-color: var(--light-gray);
        color: var(--text-color);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-gray);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main.container {
    flex: 1;
    width: 100%;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

header h1 a {
    color: inherit;
    text-decoration: none;
}

header h1 a:hover {
    opacity: 0.9;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    font-size: 0.9rem;
}

/* Main content */
main {
    padding: 3.5rem 0 3rem 0;
    min-height: calc(100vh - 200px);
}

main > h2 {
    margin: 0 0 1.5rem 0;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-color);
}

#message-container {
    margin: 0 0 1.5rem 0;
}

#message-container:empty {
    display: none;
}

/* Footer */
footer {
    background-color: var(--card-background);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 0.5rem;
}

footer a:hover {
    text-decoration: underline;
}

footer .separator {
    margin: 0 0.5rem;
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--card-background);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

/* Login page */
.login-container {
    max-width: 500px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.login-container .card {
    padding: 1.75rem;
}

.system-description {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.info-text {
    color: var(--text-muted);
    margin: 0 0 1.5rem 0;
}

.help-text {
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.deadline-hint {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

.deadline-hint:hover {
    color: var(--primary-hover);
}

/* Admin hint overlay (for exam descriptions in table) */
.admin-hint {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}

.admin-hint-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    cursor: pointer;
}

.admin-hint:hover .admin-hint-icon {
    color: var(--primary-color);
}

.admin-hint-overlay {
    display: none;
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    margin-top: 0.5rem;
    width: 250px;
    padding: 0.75rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.875rem;
    font-weight: normal;
    line-height: 1.5;
    color: var(--text-color);
    z-index: 100;
    white-space: normal;
}

.admin-hint:hover .admin-hint-overlay {
    display: block;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-align: center;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-primary:hover,
.btn-primary:active {
    background-color: var(--primary-color);
    color: white;
}

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

.btn-secondary:hover {
    background-color: #5a6268;
}

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

.btn-danger:hover {
    background-color: #c82333;
}

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

.btn-success:hover {
    background-color: #218838;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1.25rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    line-height: 1.6;
}

.alert-dismiss {
    align-self: flex-start;
    padding: 0.5rem 1.25rem;
    background-color: rgba(0,0,0,0.1);
    border: none;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.alert-dismiss:hover {
    background-color: rgba(0,0,0,0.15);
}

.alert-dismiss:active {
    transform: translateY(1px);
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-success .alert-dismiss {
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-error .alert-dismiss {
    color: #721c24;
}

.alert-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.alert-info .alert-dismiss {
    color: #0c5460;
}

/* Exam cards */
.exams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.exam-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.exam-card h4 {
    color: var(--primary-color);
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Exam title with hover tooltip */
.exam-title-wrapper {
    position: relative;
    display: inline-block;
}

.exam-title-wrapper h4 {
    cursor: help;
    margin: 0;
}

.exam-title-tooltip {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0.5rem;
    min-width: 250px;
    max-width: 350px;
    padding: 0.75rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-color);
    z-index: 100;
    font-weight: normal;
}

.exam-title-wrapper:hover .exam-title-tooltip {
    display: block;
}

.tooltip-pruefer {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.exam-hint {
    position: relative;
    flex-shrink: 0;
}

.hint-trigger {
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: help;
    padding: 0.125rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    white-space: nowrap;
}

.hint-trigger:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.hint-overlay {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    width: 280px;
    padding: 0.75rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-color);
    z-index: 100;
}

.exam-hint:hover .hint-overlay {
    display: block;
}

.exam-card > p {
    margin: 0 0 0.75rem 0;
    color: var(--text-muted);
    line-height: 1.5;
}

.exam-info {
    margin: 0 0 1rem 0;
    padding: 0.875rem;
    background-color: var(--light-gray);
    border-radius: 4px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.375rem;
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
}

.info-row:last-child {
    margin-bottom: 0;
}

.exam-actions {
    margin-top: auto;
    padding-top: 0;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.exam-actions .action-buttons {
    margin: 0.5rem 0;
}

.exam-actions .audit-link {
    display: block;
    margin-top: auto;
    padding-top: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
}

.exam-actions .audit-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.exam-actions .help-details {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.5rem 0.875rem;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.625rem;
}

.status-confirmed {
    background-color: #d4edda;
    color: #155724;
}

.status-pending,
.status-pending_withdrawal {
    background-color: #fff3cd;
    color: #856404;
}

.status-rejected,
.status-withdrawn {
    background-color: #f8d7da;
    color: #721c24;
}

/* Exam phase status badges */
.status-anmeldephase {
    background-color: #28a745;
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.status-abmeldephase {
    background-color: #20c997;
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.status-beendet {
    background-color: #17a2b8;
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.status-text {
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.registration-comment {
    margin: 0.5rem 0;
    padding: 0.5rem;
    font-size: 0.875rem;
    background-color: #f8f9fa;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 4px 4px 0;
}

/* Section */
.section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-title {
    color: var(--primary-color);
    margin: 0 0 1.5rem 0;
    padding-top: 2.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.section h3 {
    color: var(--primary-color);
    margin: 0 0 1.25rem 0;
    font-size: 1.25rem;
    font-weight: 600;
}

/* Table */
.table-container {
    background: var(--card-background);
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--light-gray);
    font-weight: 600;
    color: var(--text-color);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: var(--light-gray);
}

.data-table td {
    vertical-align: middle;
    font-variant-numeric: tabular-nums;
}

/* Registration details table - top align for better readability */
#registrations-modal .data-table td {
    vertical-align: top;
}

/* Email icon styling */
.email-icon {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
    cursor: pointer;
    transition: color 0.2s;
}

.email-icon:hover {
    color: var(--primary-hover);
}

/* Comment icon styling */
.comment-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.comment-cell:hover .comment-icon {
    color: var(--primary-color);
}

/* Truncated text with tooltip */
.truncated-text {
    display: inline-block;
    max-width: 12ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

/* FlexNow explanation */
.flexnow-explanation {
    background-color: var(--light-gray);
    border-left: 4px solid var(--info-color);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-radius: 4px;
}

.data-table td button {
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

/* Sortable table headers */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.data-table th.sortable:hover {
    background-color: var(--border-color);
}

.data-table th.sortable:active {
    background-color: var(--secondary-color);
    color: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-background);
    overflow: auto;
}

/* Large modals (like registrations) should allow page scrolling */
.modal:has(.modal-large) {
    position: absolute;
    min-height: 100%;
    height: auto;
}

.modal-content {
    background-color: var(--card-background);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
}

.modal-large {
    max-width: 100%;
    width: 1500px;
    margin: 2rem auto;
}

.modal-medium {
    max-width: 90%;
    width: 800px;
}

.modal-content h3 {
    margin-bottom: 1.5rem;
}

/* Two-column form layout */
.form-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.form-col {
    flex: 1;
    min-width: 0;
}

@media (max-width: 700px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .modal-medium {
        width: 95%;
    }
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--text-color);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-actions button {
    flex: 1;
}

/* Filters */
.filters {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--light-gray);
    border-radius: 4px;
}

.filters label {
    margin-right: 1.5rem;
    cursor: pointer;
}

.filters input[type="radio"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

/* No data message */
.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 2rem;
    background: var(--card-background);
    border-radius: 8px;
    margin: 0;
    font-size: 0.9375rem;
}

/* Message page - confirmation/cancellation feedback */
.message-container {
    max-width: 500px;
    margin: 4rem auto 2rem auto;
    padding: 0 1rem;
}

.message-card {
    text-align: center;
    padding: 2.5rem 2rem;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.message-card h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.message-card p {
    margin-bottom: 2rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.message-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
}

.message-success h2 {
    color: #166534;
}

.message-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1px solid #fca5a5;
}

.message-error h2 {
    color: #991b1b;
}

.message-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
}

.message-info h2 {
    color: #1e40af;
}

/* Dark mode adjustments for message cards */
@media (prefers-color-scheme: dark) {
    .message-success {
        background: linear-gradient(135deg, #052e16 0%, #14532d 100%);
        border: 1px solid #166534;
    }

    .message-success h2 {
        color: #86efac;
    }

    .message-error {
        background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
        border: 1px solid #991b1b;
    }

    .message-error h2 {
        color: #fca5a5;
    }

    .message-info {
        background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 100%);
        border: 1px solid #1d4ed8;
    }

    .message-info h2 {
        color: #93c5fd;
    }
}

/* Ensure tables in modals have proper width */
.modal .data-table {
    min-width: 1100px;
    table-layout: auto;
}

/* Inline editing styles */
.editable-cell {
    position: relative;
    cursor: pointer;
}

.editable-cell .edit-icon {
    width: 16px;
    height: 16px;
    margin-left: 6px;
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--primary-color);
    vertical-align: middle;
    cursor: pointer;
}

.editable-cell:hover .edit-icon {
    opacity: 1;
}

.editable-cell.editing {
    cursor: default;
}

.editable-cell.editing .edit-icon {
    display: none;
}

.inline-edit-input {
    padding: 6px 10px;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 200px;
    width: calc(100% - 70px);
    margin-right: 8px;
}

.inline-edit-input:focus {
    outline: none;
    border-color: var(--primary-hover);
}

.inline-edit-actions {
    display: inline-flex;
    gap: 4px;
}

.inline-edit-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.inline-edit-btn svg {
    width: 20px;
    height: 20px;
}

.inline-edit-btn.save-btn {
    color: var(--success-color);
}

.inline-edit-btn.save-btn:hover {
    background-color: rgba(40, 167, 69, 0.1);
}

.inline-edit-btn.cancel-btn {
    color: var(--danger-color);
}

.inline-edit-btn.cancel-btn:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

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

    .header-right {
        width: 100%;
        justify-content: center;
    }

    /* When logged in, spread user-info across full width */
    .header-right:has(.user-info) {
        justify-content: space-between;
    }

    .header-right:has(.user-info) .language-switcher {
        order: -1;
    }

    .user-info {
        gap: 0.75rem;
    }

    .exams-grid {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .table-container {
        overflow-x: auto;
    }

    .data-table {
        min-width: 600px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-large {
        max-width: 98%;
        width: auto;
    }
}

/* Loading spinner */
.spinner {
    border: 3px solid var(--light-gray);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Help section for resend email */
.help-section {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    align-items: baseline;
}

.resend-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Verlauf link in exam-actions should be on its own line */
.exam-actions > .resend-link {
    display: block;
    margin-top: 0.5rem;
}

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

.help-details {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.help-details summary {
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 500;
    user-select: none;
}

.help-details summary:hover {
    color: var(--text-color);
}

.help-details p {
    margin-top: 0.5rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.help-details a {
    color: var(--primary-color);
    text-decoration: none;
}

.help-details a:hover {
    text-decoration: underline;
}

/* Registration action buttons - uniform width */
.registration-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.registration-actions .btn {
    min-width: 100px;
    text-align: center;
}

.registration-actions .btn-audit {
    min-width: auto;
    padding: 0.4rem 0.6rem;
}

/* Status badge in table - full width */
.data-table .status-badge {
    display: block;
    width: 100%;
    text-align: center;
    white-space: nowrap;
}

/* Override button dropdown */
.override-dropdown {
    position: relative;
    display: inline-block;
}

.override-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-background);
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 6px;
    z-index: 100;
    right: 0;
    top: 100%;
    margin-top: 4px;
    border: 1px solid var(--border-color);
}

.override-dropdown-content.show {
    display: block;
}

.override-dropdown-content button {
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-color);
    transition: background-color 0.2s;
}

.override-dropdown-content button:first-child {
    border-radius: 6px 6px 0 0;
}

.override-dropdown-content button:last-child {
    border-radius: 0 0 6px 6px;
}

.override-dropdown-content button:only-child {
    border-radius: 6px;
}

.override-dropdown-content button:hover {
    background-color: var(--light-gray);
}

.override-dropdown-content button:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Audit log styles */
.audit-log-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 1rem;
}

.audit-log-entry {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.audit-log-entry:last-child {
    border-bottom: none;
}

.audit-log-entry:nth-child(even) {
    background-color: var(--light-gray);
}

.audit-log-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.audit-log-action {
    font-weight: 500;
}

.audit-log-details {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.audit-log-admin {
    display: inline-block;
    background-color: var(--warning-color);
    color: #000;
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Audit log button */
.btn-audit {
    background-color: var(--info-color);
    color: white;
}

.btn-audit:hover {
    background-color: #138496;
}

/* Comment cell with hover tooltip */
.comment-cell {
    position: relative;
}

.comment-tooltip {
    display: none;
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-right: 8px;
    padding: 0.75rem 1rem;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-color);
    z-index: 100;
    min-width: 200px;
    max-width: 350px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.comment-cell:hover .comment-tooltip {
    display: block;
}

/* Arrow pointing right towards the comment cell */
.comment-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: var(--card-background);
}

.comment-tooltip::before {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 7px solid transparent;
    border-left-color: var(--border-color);
}

/* Audit log modal */
.audit-log-modal {
    z-index: 1100;
}

.audit-log-modal .modal-content {
    max-width: 700px;
}

/* Admin overview table - exam name with tooltip */
.exam-name-cell {
    display: flex;
    align-items: center;
}

.exam-name-cell strong {
    cursor: help;
}

.beschreibung-hint {
    cursor: help;
}

.beschreibung-hint svg {
    transition: color 0.2s;
}

.beschreibung-hint:hover svg {
    color: var(--primary-color) !important;
}

/* Privacy page styles */
.privacy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.privacy-card h3 {
    color: var(--primary-color);
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.privacy-card p {
    margin: 0 0 0.75rem 0;
    line-height: 1.6;
}

.privacy-card p:last-child {
    margin-bottom: 0;
}

.privacy-card ul {
    margin: 0 0 0.75rem 0;
    padding-left: 1.25rem;
    line-height: 1.6;
}

.privacy-card ul:last-child {
    margin-bottom: 0;
}

.privacy-card li {
    margin-bottom: 0.25rem;
}

.privacy-card a {
    color: var(--primary-color);
    text-decoration: none;
}

.privacy-card a:hover {
    text-decoration: underline;
}

.privacy-card-wide {
    grid-column: 1 / -1;
}

.rights-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.5rem 2rem;
}

@media (max-width: 768px) {
    .privacy-grid {
        grid-template-columns: 1fr;
    }

    .rights-list {
        grid-template-columns: 1fr;
    }
}

/* Language Switcher */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.language-switcher .lang-active {
    color: white;
    padding: 0.25rem 0.5rem;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.language-switcher .lang-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.language-switcher .lang-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}


/* ==================== SCHEIN (CERTIFICATE) STYLES ==================== */

.schein-instructions {
    margin-bottom: 2rem;
}

.schein-instructions kbd {
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
}

.schein-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem auto;
}

.schein-container {
    background: white;
    color: #000;
    max-width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 25mm 20mm;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.schein-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.schein-top-left {
    flex: 1;
}

.schein-uni-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 0.5rem 0;
}

.schein-lehrstuhl {
    font-size: 0.95rem;
    margin: 0 0 0.25rem 0;
    color: #333;
}

.schein-pruefer {
    font-size: 0.95rem;
    margin: 0;
    color: #333;
}

.schein-logo {
    text-align: right;
}

.schein-logo img {
    width: 25mm;
    height: auto;
}

.schein-divider {
    border: none;
    border-top: 2px solid #000;
    margin: 1.5rem 0;
}

.schein-title {
    text-align: center;
    margin: 2rem 0;
}

.schein-title h1 {
    font-size: 1.6rem;
    font-weight: bold;
}

.schein-body {
    text-align: center;
    line-height: 1.8;
    font-size: 1rem;
    margin: 2rem 0;
}

.schein-body p {
    margin: 0.5rem 0;
}

.schein-body p.schein-student-name {
    font-size: 1.4rem;
    font-weight: bold;
    margin: 1rem 0 0 0;
}

.schein-body p.schein-matrikel {
    font-size: 0.95rem;
    margin: 0 0 2rem 0;
}

.schein-body p.schein-exam-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 1rem 0 0.25rem 0;
}

.schein-body p.schein-exam-details {
    font-size: 0.95rem;
    margin: 0 0 2rem 0;
}

.schein-body p.schein-result {
    margin: 1.5rem 0;
}

.schein-grade {
    font-size: 1.2rem;
}

.schein-footer {
    margin-top: 4rem;
    text-align: left;
}

.schein-location-date {
    margin-bottom: 3rem;
}

.schein-signature {
    text-align: center;
    width: 50%;
    margin-left: auto;
    margin-right: 2rem;
}

.schein-signature-line {
    border-bottom: 1px solid #000;
    width: 100%;
    margin-bottom: 0.5rem;
    height: 3rem;
}

.schein-signature-name {
    font-weight: bold;
}

.schein-signature-role {
    font-size: 0.9rem;
    color: #666;
}

/* Schein button style */
.btn-schein {
    background-color: #6f42c1;
    color: white;
}

.btn-schein:hover {
    background-color: #5a32a3;
}

/* ==================== PRINT STYLES ==================== */

@media print {
    /* Hide non-printable elements */
    .no-print,
    header,
    footer,
    .schein-instructions {
        display: none !important;
    }

    /* Reset body for print */
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        margin: 0;
        padding: 0;
    }

    /* Main container adjustments */
    main.container {
        max-width: none;
        padding: 0;
        margin: 0;
    }

    /* Schein container for A4 */
    .schein-container {
        border: none;
        box-shadow: none;
        padding: 15mm 20mm;
        margin: 0;
        max-width: none;
        min-height: auto;
        page-break-inside: avoid;
    }

    /* Ensure black text */
    .schein-container,
    .schein-container * {
        color: black !important;
        background: white !important;
    }

    /* Preserve background for exam box */
    .schein-exam {
        background-color: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ==================== ADMIN MANAGEMENT STYLES ==================== */

.admin-list {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.admin-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

.admin-list-item:nth-child(even) {
    background-color: var(--light-gray);
}

.admin-email {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    font-size: 0.9rem;
}

.admin-self-indicator {
    color: var(--primary-color);
    font-size: 0.85em;
    font-weight: 500;
    margin-left: 0.5rem;
    font-family: inherit;
}

/* ==================== NOTIFICATION SETTINGS STYLES ==================== */

.notification-settings {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.notification-setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

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

.notification-setting-row:nth-child(even) {
    background-color: var(--light-gray);
}

.notification-checkboxes {
    display: flex;
    gap: 1.5rem;
    flex-shrink: 0;
}

.notification-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}

.notification-checkboxes input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .notification-setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .notification-checkboxes {
        width: 100%;
        justify-content: flex-start;
    }

    .admin-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ==================== PARALLEL EXAM GROUP STYLES ==================== */

/* Parallel badge (OR) in student dashboard */
.parallel-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Blocked exam card styling */
.exam-card.blocked-by-parallel {
    opacity: 0.7;
    border: 2px dashed var(--text-muted);
}

.exam-card.blocked-by-parallel .exam-actions {
    background-color: var(--light-gray);
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 0.5rem;
}

/* Blocked status badge */
.status-blocked {
    background-color: #6c757d;
    color: white;
}

/* Parallel exam info box in student cards */
.parallel-exam-info {
    background-color: var(--light-gray);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.parallel-exam-info p {
    margin: 0;
}

.parallel-exam-info p + p {
    margin-top: 0.5rem;
}

/* Parallel indicator badge in admin table */
.parallel-indicator {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
    padding: 0.15rem 0.4rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 3px;
    cursor: help;
    vertical-align: middle;
}

/* Checkbox list in admin modal for parallel exams */
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    background-color: var(--light-gray);
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.checkbox-item:last-child {
    margin-bottom: 0;
}

.checkbox-item:hover {
    background-color: var(--border-color);
}

.checkbox-item input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-item span {
    font-size: 0.9rem;
}

.group-indicator {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 0.5rem;
}
