@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap');

:root {
    --bg-color: #f7f9fc;
    --container-bg: #ffffff;
    --text-color: #333;
    --primary-color: #4a90e2;
    --border-color: #e0e0e0;
    --light-gray: #f2f2f2;
    --success-color: #d4edda;
    --success-text: #155724;
    --header-color: #4a4a4a;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    background-color: var(--container-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 40px;
    width: 100%;
    max-width: 1200px;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: var(--header-color);
    margin: 0 0 10px 0;
}

header h1 i {
    margin-right: 10px;
    color: var(--primary-color);
}

header p {
    font-size: 1.1rem;
    color: #666;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.controls button {
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.controls button:hover {
    background-color: var(--light-gray);
    border-color: #ccc;
}

.controls button i {
    margin-right: 8px;
}

.grade-table-container {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
}

.total-weight {
    text-align: right;
    margin-bottom: 15px;
    font-weight: 500;
    color: #555;
}

.total-weight strong {
    color: var(--success-text);
    background-color: var(--success-color);
    padding: 4px 8px;
    border-radius: 6px;
}

.grade-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.grade-table th, .grade-table td {
    padding: 15px;
    text-align: center;
    vertical-align: middle;
}

.grade-table th {
    font-weight: 500;
    color: #666;
    background-color: var(--light-gray);
    border-radius: 8px;
}

.grade-table th:first-child, .grade-table td:first-child {
    text-align: left;
    background-color: var(--light-gray);
    border-radius: 8px;
    font-weight: 500;
}

.grade-table td {
    background-color: #fff;
}

.grade-table i.fa-trash-alt {
    color: #999;
    cursor: pointer;
    margin-left: 10px;
    visibility: hidden;
    transition: color 0.2s;
}

.grade-table th:hover i.fa-trash-alt, .grade-table td:hover i.fa-trash-alt {
    visibility: visible;
}

.grade-table i.fa-trash-alt:hover {
    color: #e53935;
}

.grade-table input[type="text"], .grade-table input[type="number"] {
    width: 80px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-align: center;
    font-size: 1rem;
    background-color: transparent;
}

.grade-table input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.weights-row td input {
    font-weight: bold;
    color: var(--primary-color);
}

.final-grade-header {
    background-color: var(--success-color) !important;
    color: var(--success-text) !important;
}

.final-grade-cell, .final-grade-weight {
    background-color: var(--success-color) !important;
    color: var(--success-text) !important;
    font-weight: bold;
    border-radius: 8px;
}

.instructions {
    background-color: var(--light-gray);
    border-radius: 12px;
    padding: 20px;
}

.instructions h3 {
    margin-top: 0;
    color: var(--header-color);
}

.instructions ul {
    padding-left: 20px;
    line-height: 1.6;
}

.csv-format {
    margin-top: 20px;
    background-color: #e9ecef;
    padding: 15px;
    border-radius: 8px;
}

.csv-format h4 {
    margin: 0 0 10px 0;
}

.csv-format pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    font-family: 'Courier New', Courier, monospace;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fff;
    padding: 20px 30px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    width: 380px;
    text-align: center;
}

.modal-description {
    margin-top: 20px;
    margin-bottom: 25px;
    color: #555;
    font-size: 1rem;
}

.modal-buttons button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px;
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background-color: #f9f9f9;
    cursor: pointer;
    font-size: 1rem;
    text-align: left;
    transition: background-color 0.2s, border-color 0.2s;
}

.modal-buttons button:hover {
    background-color: #f0f0f0;
    border-color: #ccc;
}

.modal-buttons button:last-child {
    margin-bottom: 0;
}

.modal-buttons button i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
    color: #333;
}

.close-btn {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: #555;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 30px;
    width: 30px;
    height: 30px;
    line-height: 28px;
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f0f0f0;
    transform: translateX(-50%) scale(1.1);
}

.grade-table .final-grade-invalid {
    background-color: #ffcdd2 !important;
    color: #e53935 !important;
}

/* Styles for sticky header */
.grade-table thead th,
.grade-table thead td {
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    z-index: 2;
}

.grade-table thead th {
    background-color: var(--light-gray);
}

.grade-table thead .weights-row td {
    background-color: #fff; /* Ensure it has a background to hide content scrolling underneath */
}
