/* Custom CSS for Graduation Ceremony Seat Lookup System (Light Theme) */

:root {
    /* Colors */
    --bg-main: #f8fafc;
    --bg-gradient-start: #f8fafc;
    --bg-gradient-end: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(99, 102, 241, 0.12);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --primary-color: #4f46e5;
    --primary-glow: rgba(79, 70, 229, 0.15);
    --secondary-color: #3730a3;
    
    /* Seat colors */
    --seat-student-bg: rgba(99, 102, 241, 0.06);
    --seat-student-border: rgba(99, 102, 241, 0.25);
    --seat-student-hover: #4f46e5;
    
    --seat-delegate-bg: linear-gradient(135deg, #fef3c7, #f59e0b);
    --seat-delegate-border: #d97706;
    --seat-delegate-glow: rgba(245, 158, 11, 0.25);
    
    --seat-parent-bg: linear-gradient(135deg, #f3e8ff, #8b5cf6);
    --seat-parent-border: #7c3aed;
    --seat-parent-glow: rgba(139, 92, 246, 0.25);
    
    --seat-highlight-bg: linear-gradient(135deg, #ff4e50, #f9d423);
    --seat-highlight-border: #ff4e50;
    --seat-highlight-glow: rgba(255, 78, 80, 0.5);
    
    /* Seat map interactive sizing variables */
    --seat-size: 32px;
    --seat-gap: 4px;
    --seat-font-size: 11px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: radial-gradient(circle at 50% 50%, var(--bg-gradient-end), var(--bg-gradient-start));
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header & Logo */
header {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeInDown 0.8s ease-out;
}

.logo-container {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 70px;
    height: 70px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 50%;
    margin-bottom: 1rem;
    box-shadow: 0 0 20px var(--primary-glow);
}

.logo-container svg {
    width: 36px;
    height: 36px;
    fill: var(--primary-color);
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #1e3a8a, #3b82f6, #4f46e5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Search Form */
.search-section {
    max-width: 600px;
    margin: 0 auto 3rem;
    animation: fadeInUp 0.8s ease-out;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 50px;
    padding: 6px 6px 6px 20px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.08);
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.25);
}

.search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    margin-right: 12px;
}

.search-icon svg {
    width: 20px;
    height: 20px;
}

.search-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 10px 0;
    width: 100%;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 50px;
    color: #ffffff;
    font-weight: 600;
    padding: 12px 28px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.search-button:active {
    transform: translateY(0);
}

.clear-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
    display: none;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.clear-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* Layout Grid */
.main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 1024px) {
    .main-grid {
        grid-template-columns: 380px minmax(0, 1fr);
    }
}

.panel-left, .panel-right {
    min-width: 0;
    width: 100%;
}

/* Base Panel */
.panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 2rem;
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.05);
    backdrop-filter: blur(16px);
    animation: fadeIn 1s ease-out;
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

/* Welcome Card / Instructions */
.welcome-card {
    text-align: center;
    color: var(--text-secondary);
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: inline-block;
    animation: bounce 2s infinite;
}

.instruction-list {
    text-align: left;
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.instruction-item {
    display: flex;
    gap: 12px;
    font-size: 0.9rem;
}

.instruction-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--primary-color);
    border-radius: 50%;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

/* Student Information Card */
.student-card {
    animation: scaleUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.student-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.student-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(79, 70, 229, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.1);
}

.student-avatar svg {
    width: 40px;
    height: 40px;
    fill: var(--primary-color);
}

.student-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.student-mssv {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
}

.student-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
    font-size: 0.9rem;
}

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

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    max-width: 60%;
}

/* Classification Badge */
.badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-xuatsac {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.badge-gioi {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #d97706;
}

.badge-kha {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #2563eb;
}

.badge-trungbinh {
    background: rgba(107, 114, 128, 0.1);
    border: 1px solid rgba(107, 114, 128, 0.3);
    color: #4b5563;
}

/* Ticket Design for Seat Number */
.ticket {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.03);
}

.ticket::before, .ticket::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--bg-gradient-end);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.ticket::before {
    left: -9px;
    border-right: 1px solid rgba(99, 102, 241, 0.2);
}

.ticket::after {
    right: -9px;
    border-left: 1px solid rgba(99, 102, 241, 0.2);
}

.ticket-dashed-line {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    border-top: 1px dashed rgba(99, 102, 241, 0.25);
    z-index: 1;
}

.ticket-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: relative;
    z-index: 3;
}

.ticket-block {
    display: flex;
    flex-direction: column;
}

.ticket-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.ticket-value {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--text-primary);
}

.ticket-value.seat-highlight {
    background: linear-gradient(to right, #ff4e50, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(255, 78, 80, 0.2));
}

.locate-btn {
    width: 100%;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 10px;
    color: var(--primary-color);
    padding: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.locate-btn:hover {
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Error Card */
.error-card {
    text-align: center;
    padding: 1rem 0;
}

.error-icon {
    font-size: 2.5rem;
    color: #ef4444;
    margin-bottom: 0.75rem;
}

.error-message {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Seat Map Controls */
.map-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.map-controls {
    display: flex;
    gap: 8px;
}

.control-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:hover {
    background: rgba(0, 0, 0, 0.07);
    border-color: rgba(0, 0, 0, 0.12);
}

.control-btn svg {
    width: 18px;
    height: 18px;
}

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.03);
    border-radius: 10px;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid transparent;
}

.legend-color.student {
    background: var(--seat-student-bg);
    border-color: var(--seat-student-border);
}

.legend-color.delegate {
    background: var(--seat-delegate-bg);
    border-color: var(--seat-delegate-border);
}

.legend-color.parent {
    background: var(--seat-parent-bg);
    border-color: var(--seat-parent-border);
}

.legend-color.highlighted {
    background: var(--seat-highlight-bg);
    border-color: var(--seat-highlight-border);
    box-shadow: 0 0 10px var(--seat-highlight-border);
    animation: miniPulse 1.5s infinite;
}

/* Stage banner */
.stage-container {
    width: 100%;
    margin-bottom: 2rem;
    text-align: center;
}

.stage-banner {
    display: inline-block;
    width: 80%;
    max-width: 500px;
    background: linear-gradient(to right, rgba(99, 102, 241, 0.05), rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
    border-top: 2px solid var(--primary-color);
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    padding: 12px 0;
    border-radius: 0 0 50px 50px;
    color: var(--primary-color);
    font-weight: 800;
    letter-spacing: 0.2em;
    font-size: 0.9rem;
    text-shadow: 0 0 8px rgba(99, 102, 241, 0.1);
    box-shadow: 0 5px 15px -10px rgba(99, 102, 241, 0.15);
}

/* Map Grid View */
.map-scroll-container {
    overflow: auto;
    width: 100%;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.05);
    max-height: 600px;
    /* Custom Scrollbars */
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.2) transparent;
}

.map-scroll-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.map-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 10px;
}

.map-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.seat-map-table {
    border-collapse: separate;
    border-spacing: var(--seat-gap);
    margin: 0 auto;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.seat-map-table td {
    width: var(--seat-size);
    height: var(--seat-size);
    padding: 0;
    text-align: center;
    vertical-align: middle;
    border-radius: 6px;
    font-size: var(--seat-font-size);
    font-weight: 600;
    user-select: none;
    transition: transform 0.1s;
}

/* Student seat styling */
.cell-student {
    background: var(--seat-student-bg);
    border: 1px solid var(--seat-student-border);
    color: var(--text-secondary);
}

/* Class conditional for interactive hover styling */
.cell-student.cell-assigned.interactive {
    cursor: pointer;
}

.cell-student.cell-assigned.interactive:hover {
    transform: scale(1.15);
    border-color: var(--seat-student-hover);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
    background: var(--primary-color);
    z-index: 5;
}

.cell-student.cell-unassigned {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.08);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Delegate seat styling */
.cell-delegate {
    background: var(--seat-delegate-bg);
    border: 1px solid var(--seat-delegate-border);
    color: #78350f;
    font-weight: 700;
    box-shadow: 0 0 5px var(--seat-delegate-glow);
}

/* Parent seat styling */
.cell-parent {
    background: var(--seat-parent-bg);
    border: 1px solid var(--seat-parent-border);
    color: #4c1d95;
    font-weight: 700;
    box-shadow: 0 0 5px var(--seat-parent-glow);
}

/* Row Label styling */
.cell-row-label {
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.7rem;
    pointer-events: none;
}

/* Empty cell styling (aisle) */
.cell-empty {
    background: transparent;
    border: none;
    pointer-events: none;
}

/* Highlighted seat styling */
.cell-student.highlighted {
    background: var(--seat-highlight-bg) !important;
    border-color: var(--seat-highlight-border) !important;
    color: #ffffff !important;
    font-weight: 800;
    box-shadow: 0 0 20px var(--seat-highlight-glow) !important;
    animation: seatPulse 1.8s infinite !important;
    z-index: 10;
}

/* Tooltip */
.tooltip-element {
    position: absolute;
    display: none;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 12px 14px;
    color: #ffffff;
    font-size: 0.8rem;
    z-index: 1000;
    pointer-events: none;
    backdrop-filter: blur(10px);
    transition: opacity 0.15s ease;
    opacity: 0;
    width: 230px;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 1.5rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-12px);
    }
    60% {
        transform: translateY(-6px);
    }
}

@keyframes seatPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 78, 80, 0.8);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(255, 78, 80, 0);
        transform: scale(1.18);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 78, 80, 0);
        transform: scale(1);
    }
}

@keyframes miniPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 78, 80, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(255, 78, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 78, 80, 0); }
}

@media print {
    /* Hide all interactive, navigation, and styling elements */
    header,
    .legend,
    .panel-title,
    .search-section,
    .panel-left,
    .map-controls,
    .turn-panel,
    #clearTurnBtn,
    footer,
    .nav-link,
    .locate-btn {
        display: none !important;
    }
    
    /* Set page setup for printing */
    @page {
        size: A4 landscape;
        margin: 0.8cm;
    }
    
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 9pt;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .panel {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    
    .map-scroll-container {
        overflow: visible !important;
        max-height: none !important;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
    }
    
    .seat-map-table {
        page-break-inside: avoid;
        margin: 0 auto !important;
        /* Downscale grid variables to fit landscape print page */
        --seat-size: 20px !important;
        --seat-gap: 2px !important;
        --seat-font-size: 7px !important;
    }
    
    .seat-map-table td {
        border-radius: 2px !important;
        box-shadow: none !important;
    }

    .cell-student.cell-assigned {
        background: #e2e8f0 !important;
        border: 1px solid #94a3b8 !important;
        color: #334155 !important;
    }
    
    .cell-student.cell-unassigned {
        background: #f8fafc !important;
        border: 1px solid #cbd5e1 !important;
        color: #94a3b8 !important;
    }
    
    .cell-delegate {
        background: #fef3c7 !important;
        border: 1px solid #fbbf24 !important;
        color: #92400e !important;
    }
    
    .cell-parent {
        background: #f3e8ff !important;
        border: 1px solid #a855f7 !important;
        color: #6b21a8 !important;
    }
    
    .cell-student.highlighted,
    .cell-student.highlight-turn {
        background: #bfdbfe !important;
        border: 2px solid #2563eb !important;
        color: #1e3a8a !important;
        font-weight: 800 !important;
    }
    
    .stage-container {
        margin-bottom: 1.5rem !important;
    }
    
    .stage-banner {
        width: 100% !important;
        background: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        color: #1e3a8a !important;
        text-shadow: none !important;
        box-shadow: none !important;
        padding: 6px 0 !important;
        border-radius: 0 0 20px 20px !important;
    }
    
    /* Force browser to print background graphics and colors */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}
