/* Exam Seat Plan page styles (kept consistent with existing dark tool pages) */

body.exam-seatplan-page {
    background: #0a0a0f;
    color: #e5e7eb;
    color-scheme: dark;
}

body.exam-seatplan-page .app-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

.gradient-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.gradient-overlay::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 300px;
    background: linear-gradient(to top, #0a0a0f 0%, transparent 100%);
}

/* Header */
header.seatplan-header {
    background: transparent;
    padding: 1.75rem 0 1.25rem;
}

body.exam-seatplan-page header::before {
    content: none;
}

body.exam-seatplan-page .header-content {
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

body.exam-seatplan-page .back-link {
    align-self: flex-start;
    margin-bottom: 1.5rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
    border-radius: 999px;
    white-space: nowrap;
}

.seatplan-tool-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.seatplan-hero {
    margin-top: 0.5rem;
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    animation: fadeInDown 0.6s ease;
}

.seatplan-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.8);
    color: #ffffff;
    font-size: 1.8rem;
    animation: float 3s ease-in-out infinite;
}

.seatplan-hero-title {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.2rem;
    line-height: 1.2;
    text-align: center;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.gradient-text {
    background: linear-gradient(135deg, #667eea, #f093fb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.seatplan-hero-subtitle {
    font-size: 1.05rem;
    color: #94a3b8;
    max-width: 680px;
}

/* Card overrides for dark */
body.exam-seatplan-page .card {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(148, 163, 184, 0.15);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    overflow: visible; /* Override to allow dropdowns to overflow */
}

body.exam-seatplan-page .card-header {
    background: transparent;
    padding: 1.75rem 2rem 1.25rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.exam-seatplan-page .card-header h2 {
    color: #f8fafc;
    font-size: 1.5rem;
    font-weight: 700;
}

body.exam-seatplan-page .card-header p {
    color: #94a3b8;
    margin-top: 0.25rem;
    font-size: 0.95rem;
}

body.exam-seatplan-page .input-group label {
    color: #cbd5e1;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

/* Modern Select Wrapper */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.custom-select-wrapper select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding: 0.85rem 1.25rem;
    padding-right: 2.75rem;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #f8fafc;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
}

.custom-select-wrapper .custom-select-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #94a3b8;
    font-size: 0.85rem;
    transition: transform 0.2s ease;
}

.custom-select-wrapper select:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.custom-select-wrapper select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(15, 23, 42, 0.4);
}

/* Input Wrapper & Icons */
.input-wrapper.has-icon {
    position: relative;
}

.input-wrapper.has-icon .input-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
}

.input-wrapper.has-icon input {
    padding-left: 2.75rem;
}

body.exam-seatplan-page .input-wrapper input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #f8fafc;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

body.exam-seatplan-page .input-wrapper input::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

body.exam-seatplan-page .input-wrapper input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

body.exam-seatplan-page .input-wrapper input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(15, 23, 42, 0.4);
}

/* Autocomplete Dropdown */
.autocomplete-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 50;
    max-height: 220px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.autocomplete-container.active .autocomplete-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.autocomplete-item {
    padding: 0.85rem 1.25rem;
    color: #e2e8f0;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s ease;
    display: flex;
    flex-direction: column;
}

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

.autocomplete-item:hover, .autocomplete-item.selected {
    background: rgba(102, 126, 234, 0.15);
}

.autocomplete-course-code {
    font-weight: 700;
    color: #f8fafc;
    font-size: 0.95rem;
}

.autocomplete-course-title {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}

.autocomplete-item.no-results {
    color: #94a3b8;
    text-align: center;
    padding: 1.5rem;
    cursor: default;
}
.autocomplete-item.no-results:hover {
    background: transparent;
}

/* Modern Button */
.seatplan-actions {
    padding: 1.5rem 2rem 2.5rem;
}

.modern-btn {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.modern-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.modern-btn:active:not(:disabled) {
    transform: translateY(0);
}

body.exam-seatplan-page .btn-outline {

    background: rgba(15, 23, 42, 0.25);
    border-color: rgba(148, 163, 184, 0.22);
    color: #e2e8f0;
}

body.exam-seatplan-page .btn-outline:hover {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(148, 163, 184, 0.35);
    color: #f8fafc;
}

.seatplan-actions {
    padding: 0 2rem 2rem;
}

.seatplan-hint {
    margin-top: 0.45rem;
    font-size: 0.85rem;
    color: rgba(148, 163, 184, 0.95);
}

.seatplan-student-id {
    grid-column: 1 / -1;
}

.seatplan-result {
    padding: 2rem;
}

.seatplan-result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

/* Specific grid spans for result tiles on all screen sizes */
.seatplan-result-grid .seatplan-result-tile:nth-child(1) { /* Course */
    grid-column: 1 / -1;
}

.seatplan-result-grid .seatplan-result-tile:nth-child(2) { /* Section */
    grid-column: span 1;
}

.seatplan-result-grid .seatplan-result-tile:nth-child(3) { /* Exam Date */
    grid-column: span 1;
}

.seatplan-result-grid .seatplan-result-tile:nth-child(4) { /* Exam Time */
    grid-column: 1 / -1;
}

.seatplan-result-tile {
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(15, 23, 42, 0.35);
}

.seatplan-result-label {
    font-size: 0.85rem;
    color: rgba(148, 163, 184, 0.95);
    margin-bottom: 0.35rem;
    font-weight: 700;
}

.seatplan-result-value {
    font-size: 1.1rem;
    color: #f8fafc;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.seatplan-room {
    font-size: 1.8rem;
    line-height: 1.1;
}

.seatplan-status {
    margin: 1.25rem 0 2rem;
    text-align: center;
    color: rgba(148, 163, 184, 0.95);
    min-height: 1.2rem;
}

@media (max-width: 780px) {
    .seatplan-hero-title {
        font-size: 1.85rem;
    }

    .seatplan-result-grid {
        /* Maintain 2 columns so Section and Date stay side-by-side */
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.9rem;
    }

    .seatplan-actions {
        padding: 0 1.25rem 1.5rem;
    }
}

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

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

/* Room Allocations List Styling */
.seatplan-allocations-list {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.seatplan-allocation-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.seatplan-allocation-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(102, 126, 234, 0.25);
}

.seatplan-alloc-room {
    font-weight: 800;
    color: #38bdf8;
    font-size: 1.2rem;
    letter-spacing: -0.01em;
}

.seatplan-alloc-range {
    font-family: 'Inter', monospace;
    font-size: 0.95rem;
    color: #e2e8f0;
    font-weight: 500;
}

/* Narrow screens optimization: stack allocation room and ID range vertically */
@media (max-width: 580px) {
    .seatplan-allocation-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
        padding: 0.85rem 1rem;
    }

    .seatplan-alloc-room {
        font-size: 1.1rem;
    }

    .seatplan-alloc-range {
        font-size: 0.88rem;
    }
}

/* Highlight styling for the matched room allocation */
.seatplan-allocation-item.matched-highlight {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.45);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.15);
    position: relative;
    padding-top: 1.6rem;
}

.seatplan-allocation-item.matched-highlight::before {
    content: 'YOUR ALLOCATED ROOM';
    position: absolute;
    top: 0;
    left: 1.25rem;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.2rem 0.65rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.seatplan-allocation-item.matched-highlight .seatplan-alloc-room {
    color: #10b981;
}

/* Adjust warning alert style */
.seatplan-warning-alert {
    animation: fadeInDown 0.3s ease;
}

@media (max-width: 580px) {
    .seatplan-allocation-item.matched-highlight {
        padding-top: 1.8rem;
    }
}

