:root {
    --fw-header-height: 100px;
    --fw-header-bg: #ffffff;
    --fw-body-size: 16px;
    --fw-body-color: #111111;
    --fw-link-color: #0d6efd;
    --fw-menu-size: 16px;
    --fw-menu-color: #111111;
    --primary-color: #0073aa;
    --primary-hover: #005177;
    --success-bg: #e7f7e7;
    --success-border: #75c775;
    --error-bg: #fdeaea;
    --error-border: #e57373;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: var(--fw-body-size);
    color: var(--fw-body-color);
    background-color: #ffffff;
    line-height: 1.5;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header Styling */
.site-header {
    height: var(--fw-header-height);
    background: var(--fw-header-bg);
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

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

.branding {
    display: flex;
    align-items: center;
}

.custom-logo {
    max-width: 350px;
    height: auto;
    display: block;
}

.primary-nav .menu {
    display: flex;
    list-style: none;
    gap: 24px;
    align-items: center;
}

.primary-nav .menu-item a {
    text-decoration: none;
    color: var(--fw-menu-color);
    font-size: var(--fw-menu-size);
    font-weight: 600;
    transition: color 0.2s ease;
}

.primary-nav .menu-item.current-menu-item a,
.primary-nav .menu-item a:hover {
    color: var(--primary-color);
}

/* Styled Menu Button matching WordPress mobile theme screenshot */
.nav-toggle {
    display: none;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.nav-toggle:hover {
    background: #f8fafc;
}

/* Main Area */
.site-main {
    padding: 30px 0 60px 0;
}

/* Form Styling matching WordPress FeatherWP results-manager plugin */
#results-manager-wrapper {
    max-width: 500px;
    margin: 30px auto;
    padding: 28px 24px;
    border: 1px solid #dddddd;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

#results-manager-form label {
    font-weight: 700;
    margin-bottom: 10px;
    display: block;
    color: #222222;
    font-size: 15px;
}

#results-manager-form input[type="text"] {
    padding: 12px 14px;
    margin-bottom: 18px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#results-manager-form input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

#results-manager-form button {
    padding: 11px 22px;
    border: none;
    background-color: var(--primary-color);
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

#results-manager-form button:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

#results-manager-form button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Form Response Container */
#results-manager-response {
    margin-top: 22px;
    padding: 16px;
    border-radius: 4px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

#results-manager-response.success {
    background-color: var(--success-bg);
    border: 1px solid var(--success-border);
}

#results-manager-response.error {
    background-color: var(--error-bg);
    border: 1px solid var(--error-border);
    color: #c62828;
    font-weight: 600;
}

.download-button {
    display: inline-block;
    padding: 12px 24px;
    background-color: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 700;
    font-size: 15px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.download-button:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

/* Modal Overlay & Result Sheet Container */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(3px);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 25px 15px;
    overflow-y: auto;
}

.modal-content {
    background: #ffffff;
    width: 100%;
    max-width: 900px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    padding: 25px;
    margin: 20px auto;
    animation: slideDown 0.3s ease-out;
}

.close-modal {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 32px;
    font-weight: 300;
    color: #444;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #d00000;
}

/* Result Sheet Specific Styling - Pixel Match Original Screenshot */
.result-sheet-container {
    background: #ffffff;
    color: #000000;
}

/* Board Header Banner Image */
.board-header-banner {
    width: 100%;
    margin-bottom: 20px;
    text-align: center;
    overflow: hidden;
}

.original-board-banner {
    width: 100%;
    max-height: 120px;
    object-fit: fill;
    display: block;
    border-radius: 2px;
}

/* Result Title */
.result-title-section {
    text-align: center;
    margin-bottom: 18px;
}

.result-title-section h3 {
    font-family: "Times New Roman", Times, Georgia, serif;
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #000000;
    text-transform: uppercase;
    margin: 0;
}

/* Marksheet Inner Box */
.marksheet-card-box {
    background-color: #d8e4b7;
    border: 2px solid #000000;
    padding: 16px;
    border-radius: 2px;
}

.marksheet-top-info {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.student-details-table {
    flex: 1;
    display: table;
    width: 100%;
}

.detail-row {
    display: table-row;
    line-height: 1.6;
}

.detail-label {
    display: table-cell;
    font-family: Arial, sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    color: #000000;
    padding-right: 15px;
    padding-bottom: 3px;
    white-space: nowrap;
    width: 180px;
}

.detail-value {
    display: table-cell;
    font-family: Arial, sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    color: #000000;
    padding-bottom: 3px;
}

.student-photo-box {
    width: 145px;
    flex-shrink: 0;
    text-align: right;
}

.student-photo-box img {
    width: 135px;
    height: 165px;
    object-fit: cover;
    border: 2px solid #555555;
    background-color: #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* Marks Table */
.marks-table-wrapper {
    margin-top: 5px;
    width: 100%;
}

.marks-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #000000;
    font-family: Arial, sans-serif;
}

.marks-table th {
    background-color: #ff0000;
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
    padding: 6px 8px;
    border: 2px solid #000000;
    text-transform: uppercase;
}

.marks-table td {
    border: 1px solid #000000;
    padding: 5px 10px;
    font-size: 12.5px;
    font-weight: 500;
    text-align: center !important;
    color: #000000;
    background-color: rgba(255, 255, 255, 0.4);
}

/* Excel Green Error/Warning Corner Tag */
.excel-warning {
    position: relative;
}

.excel-warning::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-top: 7px solid #107c41;
    border-right: 7px solid transparent;
    z-index: 2;
}

.marks-table td.subject-name {
    text-align: left;
    padding-left: 20px;
}

.marks-table tfoot .total-row td {
    background-color: #ff0000;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
}

.marks-table tfoot .total-row td.total-label {
    text-align: left;
    padding-left: 20px;
}

.marks-table tfoot .remarks-row td {
    background-color: #9bdd62;
    color: rgb(33 134 228);
    font-size: 13.5px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
    padding: 7px 10px;
    border: 2px solid #000000;
}

/* Result Action Buttons */
.result-actions {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.action-btn.btn-print {
    background-color: #0d6efd;
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 5px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.action-btn.btn-print:hover {
    background-color: #0b5ed7;
}

.action-link {
    color: #5814a6;
    font-size: 18px;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    font-family: Arial, sans-serif;
}

.action-link:hover {
    color: #3b0d73;
}

/* Keyframe Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Media Queries & Responsive Mobile Design */
@media (max-width: 768px) {
    .site-header {
        height: auto;
        padding: 12px 0;
    }

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

    .branding {
        max-width: calc(100% - 90px);
    }

    .custom-logo {
        max-width: 220px;
        height: auto;
    }

    .nav-toggle {
        display: block;
    }

    .primary-nav {
        width: 100%;
        display: none;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid #eeeeee;
    }

    .primary-nav.open {
        display: block;
    }

    .primary-nav .menu {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #results-manager-wrapper {
        margin: 25px 12px;
        padding: 22px 16px;
    }

    .modal-overlay {
        padding: 10px 8px;
    }

    .modal-content {
        padding: 14px 10px;
    }

    .marksheet-top-info {
        flex-direction: column-reverse;
        align-items: center;
    }

    .student-photo-box {
        text-align: center;
        margin-bottom: 10px;
    }

    .detail-label {
        width: 130px;
        font-size: 11.5px;
    }

    .detail-value {
        font-size: 11.5px;
    }

    .marks-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .marks-table {
        min-width: 480px;
    }
}

/* Print Stylesheet for clean Result Sheet PDF printing */
@media print {
    body * {
        visibility: hidden;
    }

    .modal-overlay,
    .modal-content,
    #printable-result-sheet,
    #printable-result-sheet * {
        visibility: visible;
    }

    .modal-overlay {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: auto;
        background: none;
        padding: 0;
    }

    .modal-content {
        box-shadow: none;
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .close-modal,
    .no-print {
        display: none !important;
    }

    .marksheet-card-box {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .marks-table th,
    .total-row td,
    .remarks-row td {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}