:root {
    --primary-color: #003366;
    --secondary-color: #FFCC00;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--light-color);
    margin: 0;
    padding: 0;
    color: var(--dark-color);
    line-height: 1.4;
}

.container {
    max-width: 800px;
    margin: 30px auto;
    padding: 20px;
}

.university-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid #2c3e50;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
    position: relative;
}

.university-logo {
    height: 80px;
    margin-bottom: 15px;
    height: 80px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.university-name {
    color: var(--primary-color);
    margin: 5px 0;
    font-size: 24px;
    font-weight: 700;
}

.form-container {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-top: 5px solid var(--primary-color);
    margin-bottom: 30px;
}

.form-title {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 25px;
    font-size: 22px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--primary-color);
}

input[type="text"],
input[type="date"],
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    transition: border 0.3s;
}

.generate-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    width: 100%;
    transition: all 0.3s;
}

.generate-btn:hover {
    background-color: #002244;
}

/* Cover Page Styles */
.cover-page {
    font-family: 'Times New Roman', serif;
    background-color: white;
    padding: 40px;
    margin-top: 30px;
    display: none;
    position: relative;
}

.cover-page::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    pointer-events: none;
}

.cover-header {
    text-align: center;
    margin-bottom: 7px;
}

.cover-university {
    font-size: 20pt;
    margin-bottom: 5px;
}

.cover-department {
    font-size: 16pt;
    margin-bottom: 10px;
}

.assignment-title {
    font-family: 'Times New Roman', serif;
    font-size: 14pt;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: 2px;
    margin-bottom: 3px;
    border-top: 1px solid black;
    border-bottom: 1px solid black;
    padding: 8px 0;
    display: inline-block;
}

.cover-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.cover-table,
.cover-table th,
.cover-table td {
    border: 1px solid black;
}

.cover-table th,
.cover-table td {
    padding: 10px;
}

.center {
    text-align: center;
}

.submitted-to,
.submitted-by {
    margin-bottom: 30px;
}

.signature-space {
    height: 100px;
}

.print-btn-container {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 30px;
}

.print-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.print-btn:hover {
    background-color: #002244;
}

/* ==================== PRINT STYLES (SINGLE-PAGE ONLY) ==================== */
@media print {
    /* ── Page setup ── */
    @page {
        size: A4;
        margin: 15mm;
    }

    body {
        margin: 0;
        padding: 0;
        background: white;
    }

    /* ── Strip ALL non-cover elements from layout ── */
    #notificationContainer,
    .university-header,
    .admin-access-btn,
    .form-container,
    #printBtnContainer,
    .notification-container,
    .edit-mode-btn,
    #enableEditBtn,
    #lockEditBtn {
        display: none !important;
    }

    /* ── Neutralise container so it adds zero height ── */
    .container {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* ── Cover page is the ONLY visible element ── */
    .cover-page {
        display: block !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        left: auto !important;
        top: auto !important;
        margin: 0 !important;
        padding: 20px 0 !important;
        box-sizing: border-box;
        overflow: visible !important;
        page-break-inside: avoid;
        page-break-after: avoid;
    }

    /* ── Remove pseudo-element that can add phantom space ── */
    .cover-page::before {
        display: none !important;
        content: none !important;
    }

    /* ── Edit-mode: strip visual hints ── */
    .editing-mode [data-editable].editable-active,
    [data-editable].editable-active {
        border-bottom: none !important;
        background-color: transparent !important;
        padding: 0 !important;
        border-radius: 0 !important;
        cursor: default !important;
        display: inline !important;
    }

    .editing-mode [data-editable].editable-active:focus {
        outline: none !important;
        border-bottom: none !important;
        background-color: transparent !important;
    }

    /* ── Font sizing for print ── */
    .cover-university {
        font-size: 17pt;
    }

    .cover-department {
        font-size: 13pt;
    }

    .assignment-title {
        font-size: 13pt;
    }

    .cover-table {
        font-size: 11pt;
    }

    .faculty-multi .faculty-block {
        font-size: 10pt;
    }

    .faculty-single .faculty-block {
        font-size: 11pt;
    }

    .faculty-cell {
        padding: 4px !important;
    }
}

.note-container {
    width: 100%;
    text-align: center;
    margin-top: 10px;
    padding: 10px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 5px;
}

.note-text {
    margin: 0;
    color: #856404;
    font-size: 14px;
    line-height: 1.4;
}

/* Responsive design update */
@media (max-width: 768px) {
    .university-header {
        flex-direction: column;
        text-align: center;
        padding: 15px 0;
    }

    .note-container {
        order: 3;
        /* Make sure note appears at bottom on mobile */
        margin-top: 15px;
    }

    .university-logo {
        height: 60px;
    }
}

.whatsapp-cta-container {
    text-align: center;
    background: linear-gradient(135deg, #25D366, #128C7E);
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-width: 400px;
}

.whatsapp-cta-text {
    color: white;
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.whatsapp-btn {
    display: inline-block;
    background: white;
    color: #25D366;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.whatsapp-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.admin-access-btn {
    display: block;
    text-align: center;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    margin: 0 auto 20px auto;
    max-width: 400px;
}

.admin-access-btn:hover {
    background: #004080;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .university-header {
        flex-direction: column;
        text-align: center;
        padding: 15px 0;
    }

    .university-logo {
        height: 60px;
    }

    .whatsapp-cta-container {
        max-width: 100%;
        padding: 12px 20px;
    }

    .whatsapp-cta-text {
        font-size: 13px;
    }

    .whatsapp-btn {
        font-size: 13px;
        padding: 8px 16px;
    }

    .admin-access-btn {
        font-size: 14px;
        padding: 10px 20px;
        max-width: 90%;
    }
}

/* Admin Panel Styles */
.admin-container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 20px;
}

.admin-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-nav button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.admin-nav button:hover {
    background-color: #002244;
}

.admin-nav button.active {
    background-color: var(--secondary-color);
    color: var(--dark-color);
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.course-list {
    margin-top: 20px;
}

.course-item {
    background-color: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.course-actions button {
    padding: 5px 10px;
    margin-left: 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.edit-btn {
    background-color: #007bff;
    color: white;
}

.delete-btn {
    background-color: #dc3545;
    color: white;
}

.experiment-list {
    margin-top: 15px;
    padding-left: 20px;
}

.experiment-item {
    padding: 8px;
    background-color: #f8f9fa;
    margin-bottom: 5px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

.success-message {
    color: #28a745;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--primary-color);
}

/* Notification System Styles */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
}

.notification {
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s ease-out;
    font-size: 14px;
    line-height: 1.4;
}

.notification.success {
    background-color: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.notification.error {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.notification.warning {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    color: inherit;
    cursor: pointer;
    margin-left: 10px;
    opacity: 0.7;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    opacity: 1;
}

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

/* Counter Display Styles */
.counter-display {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
}

.counter-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary-color);
}

/* Student List Styles */
.student-item {
    background-color: white;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 4px solid #28a745;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-item .student-info small {
    color: #666;
    font-size: 13px;
}

.student-actions button {
    padding: 5px 10px;
    margin-left: 5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* Student form section spacing */
#addStudent .form-container,
#editStudent .form-container,
#viewStudents .form-container {
    margin-top: 0;
}

/* Student Search */
.student-search-wrapper {
    margin-bottom: 20px;
}

.student-search-input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 12px center;
}

.student-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
    background-color: #fff;
}

/* ==================== EDIT MODE STYLES ==================== */

/* Edit mode toggle buttons */
.edit-mode-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 8px;
}

#enableEditBtn {
    background-color: #f0f4ff;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

#enableEditBtn:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.lock-btn {
    background-color: #fef3c7;
    color: #92400e;
    border: 2px solid #f59e0b;
}

.lock-btn:hover {
    background-color: #f59e0b;
    color: #fff;
}

/* Editable field highlight when editing mode is active */
.editing-mode [data-editable].editable-active {
    border-bottom: 2px dashed #3b82f6;
    background-color: rgba(59, 130, 246, 0.04);
    border-radius: 3px;
    padding: 1px 4px;
    cursor: text;
    transition: background-color 0.2s ease;
    /* Preserve font inheritance */
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.editing-mode [data-editable].editable-active:focus {
    outline: none;
    border-bottom: 2px solid #3b82f6;
    background-color: rgba(59, 130, 246, 0.08);
}

/* Ensure editable spans don't break table layout */
.editing-mode [data-editable].editable-active {
    display: inline-block;
    min-width: 20px;
    max-width: 100%;
    word-break: break-word;
}

/* Admin Panel UI Retouch */
.admin-container {
    max-width: 1100px;
}

.admin-nav {
    background: #fff;
    padding: 8px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    gap: 6px;
}

.admin-nav button {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
    background-color: #f1f5f9;
    color: #475569;
    transition: all 0.2s ease;
}

.admin-nav button:hover {
    background-color: #e2e8f0;
    color: #1e293b;
    transform: translateY(-1px);
}

.admin-nav button.active {
    background: linear-gradient(135deg, var(--primary-color), #004d99);
    color: #fff;
    box-shadow: 0 3px 10px rgba(0, 51, 102, 0.3);
}

.form-container {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border-top: 4px solid var(--primary-color);
    padding: 35px;
}

.form-title {
    font-size: 20px;
    margin-bottom: 30px;
    position: relative;
    padding-bottom: 12px;
}

.form-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: var(--secondary-color);
    border-radius: 2px;
}

input[type="text"],
input[type="date"],
select {
    padding: 12px 15px;
    border: 2px solid #e8ecf1;
    border-radius: 8px;
    font-size: 15px;
    background: #fafbfc;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.08);
    background: #fff;
}

label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}

.generate-btn {
    border-radius: 8px;
    padding: 14px 25px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--primary-color), #004d99);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.25);
    transition: all 0.3s ease;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #004080, #003366);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 51, 102, 0.35);
}

.course-item {
    border-radius: 8px;
    padding: 16px 18px;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.course-item:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transform: translateX(2px);
}

.course-actions button {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
}

.edit-btn {
    background-color: #3b82f6;
    color: white;
}

.edit-btn:hover {
    background-color: #2563eb;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.delete-btn {
    background-color: #ef4444;
    color: white;
}

.delete-btn:hover {
    background-color: #dc2626;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.counter-display {
    background: linear-gradient(135deg, var(--primary-color), #004d99);
    border-radius: 10px;
    padding: 18px 24px;
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.2);
}

.counter-number {
    font-size: 28px;
    font-weight: 800;
}

.experiment-item {
    border-radius: 6px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e8ecf1;
    transition: all 0.2s ease;
}

.experiment-item:hover {
    background: #f1f5f9;
}

hr {
    border: none;
    border-top: 1px solid #e8ecf1;
    margin: 30px 0;
}

/* ==================== MULTI-FACULTY LAYOUT ==================== */

/* Faculty container — single faculty: centered; multiple: side-by-side */
.faculty-single {
    display: flex;
    justify-content: center;
}

.faculty-multi {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    justify-content: center;
    align-items: stretch;
}

/* Each faculty block gets equal width */
.faculty-multi .faculty-block {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 6px 8px;
    box-sizing: border-box;
    border-right: 1px solid #ccc;
}

.faculty-multi .faculty-block:last-child {
    border-right: none;
}

/* Single faculty block */
.faculty-single .faculty-block {
    text-align: center;
    padding: 6px 8px;
}

/* Ensure faculty table cell doesn't add extra padding */
.faculty-cell {
    padding: 6px !important;
}

/* Responsive: on very narrow screens, stack faculty vertically */
@media (max-width: 480px) {
    .faculty-multi {
        flex-wrap: wrap;
    }

    .faculty-multi .faculty-block {
        flex: 1 1 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid #ccc;
        padding: 8px 6px;
    }

    .faculty-multi .faculty-block:last-child {
        border-bottom: none;
    }
}

/* ==================== FACULTY MANAGEMENT UI (ADMIN) ==================== */

.faculty-management {
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e8ecf1;
}

.faculty-management h4 {
    color: var(--primary-color);
    font-size: 15px;
    margin: 0 0 12px 0;
    font-weight: 600;
}

.faculty-member-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.faculty-member-card .fm-field {
    flex: 1;
    min-width: 130px;
}

.faculty-member-card .fm-field label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 3px;
    display: block;
}

.faculty-member-card .fm-field input,
.faculty-member-card .fm-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    background: #fafbfc;
}

.faculty-member-card .fm-field input:focus,
.faculty-member-card .fm-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 51, 102, 0.08);
}

.faculty-member-card .fm-remove-btn {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s;
    align-self: flex-end;
}

.faculty-member-card .fm-remove-btn:hover {
    background: #fecaca;
}

.fm-add-btn {
    background: #e0f2fe;
    color: #0369a1;
    border: 1.5px dashed #7dd3fc;
    border-radius: 8px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    width: 100%;
    transition: all 0.2s;
    margin-top: 8px;
}

.fm-add-btn:hover {
    background: #bae6fd;
    border-color: #38bdf8;
}

.fm-info-text {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
    text-align: center;
}
