/* Custom CSS for Exam Management System */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 10px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f6fa;
}

/* Navigation */
.navbar-brand {
    font-weight: 600;
    font-size: 1.3rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.navbar-nav .dropdown-menu {
    border: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    border: none;
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a72e8 0%, #6b449e 100%);
}

/* Forms */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 2px solid #e9ecef;
    padding: 12px 15px;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

/* Tables */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table th {
    background-color: var(--light-color);
    font-weight: 600;
    border: none;
    color: var(--dark-color);
}

.table td {
    border: none;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

/* Statistics Cards */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius);
    color: white;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.stats-card .icon {
    font-size: 3rem;
    opacity: 0.8;
    margin-bottom: 15px;
}

.stats-card .number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.stats-card .label {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    border-left-color: var(--success-color);
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-left-color: var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-left-color: var(--warning-color);
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-left-color: var(--info-color);
    color: #0c5460;
}

/* Badges */
.badge {
    border-radius: 20px;
    padding: 8px 12px;
    font-weight: 500;
}

/* Pagination */
.pagination .page-link {
    border-radius: var(--border-radius);
    margin: 0 2px;
    border: none;
    color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

/* Editing Area */
.editing-area {
    background-color: #fff3cd !important;
    border: 2px solid #ffc107 !important;
    border-radius: var(--border-radius);
}

/* Sitting Plan */
.seat {
    width: 60px;
    height: 60px;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.seat-number {
    font-size: 0.7rem;
    color: #bbb;
    font-weight: normal;
    opacity: 0.5;
}

.seat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 2px;
}

.student-name-short {
    font-size: 0.9rem;
    font-weight: bold;
    line-height: 1;
}

.student-name-full {
    font-size: 0.65rem;
    line-height: 1.1;
    text-align: center;
    max-width: 100%;
    word-break: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.seat.occupied {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-color: var(--primary-color);
    border-width: 3px;
}

.seat.different-subject {
    /* GREEN - Different Subject */
    background-color: #28a745 !important;
    color: white !important;
    border-color: #1e7e34 !important;
    border-width: 3px;
}

.seat.same-class-group {
    /* YELLOW - Same Class Same Group (Conflict) */
    background-color: #ffc107 !important;
    color: #212529 !important;
    border-color: #e0a800 !important;
    border-width: 3px;
    font-weight: bold;
}

.seat.different-class-same-group {
    /* ORANGE - Different Class Same Group */
    background-color: #fd7e14 !important;
    color: white !important;
    border-color: #e86a00 !important;
    border-width: 3px;
}

.seat.different-class-different-group {
    /* CYAN - Different Class Different Group (Good Placement) */
    background-color: #17a2b8 !important;
    color: white !important;
    border-color: #0b6b8a !important;
    border-width: 3px;
}

.seat:hover {
    transform: scale(1.15);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.seat.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    .table {
        font-size: 12px;
    }
    
    .page-break {
        page-break-after: always;
    }
}

/* Drag and Drop */
.draggable {
    cursor: move;
}

.drop-zone {
    min-height: 50px;
    border: 2px dashed #ddd;
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    color: #999;
    transition: all 0.3s ease;
}

.drop-zone.drag-over {
    border-color: var(--primary-color);
    background-color: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
}

/* Loading Spinner */
.spinner-border-custom {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Modal Customizations */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-footer {
    border-top: none;
    padding-top: 0;
}

/* Time Picker Styles */
.time-picker {
    display: flex;
    gap: 10px;
    align-items: center;
}

.time-wheel {
    width: 60px;
    height: 100px;
    overflow-y: scroll;
    border: 1px solid #ddd;
    border-radius: 5px;
    text-align: center;
}

.time-wheel option {
    padding: 5px;
    cursor: pointer;
}

.time-wheel option:hover {
    background-color: var(--light-color);
}

/* Tag Input (Email-like) */
.tag-input-container {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 8px;
    min-height: 42px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    cursor: text;
}

.tag-input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.tag {
    background-color: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.tag .remove-tag {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.tag .remove-tag:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.tag-input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 120px;
    padding: 4px;
    font-size: 1rem;
}

.tag-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tag-suggestion {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
}

.tag-suggestion:hover {
    background-color: var(--light-color);
}

.tag-suggestion:last-child {
    border-bottom: none;
}

/* QR Code Styling */
.qr-code {
    border: 2px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    background: white;
    display: inline-block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container-fluid {
        padding: 10px;
    }
    
    .card {
        margin-bottom: 20px;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .seat {
        width: 35px;
        height: 35px;
        font-size: 0.7rem;
    }
    
    .stats-card .number {
        font-size: 2rem;
    }
    
    .stats-card .icon {
        font-size: 2.5rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #2c3e50;
        --dark-color: #ecf0f1;
    }
    
    body {
        background-color: #1a1a1a;
        color: #ecf0f1;
    }
    
    .card {
        background-color: #2c3e50;
        color: #ecf0f1;
    }
    
    .table th {
        background-color: #34495e;
        color: #ecf0f1;
    }
    
    .form-control, .form-select {
        background-color: #34495e;
        border-color: #4a6741;
        color: #ecf0f1;
    }
    
    .form-control:focus, .form-select:focus {
        background-color: #34495e;
        border-color: var(--primary-color);
        color: #ecf0f1;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-lg-custom {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
}

.border-gradient {
    border: 2px solid;
    border-image: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-image-slice: 1;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Multi-Room Seating Arrangement Styling */
.room-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    transition: all 0.3s ease;
}

.room-section:hover {
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.room-section h6 {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.room-section h6::before {
    content: '🏫';
    font-size: 20px;
}

.room-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #555;
}

.room-info-item {
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
}

.room-info-item strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 2px;
}

.seating-grid {
    display: inline-grid;
    gap: 8px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

#multiRoomContainer {
    margin-top: 20px;
    padding: 10px 0;
}

/* Responsive Design for Multiple Rooms */
@media (max-width: 768px) {
    .room-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .room-section h6 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .room-info {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .seating-grid {
        gap: 6px;
        padding: 10px;
        overflow-x: auto;
    }
}