* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #ecf0f1;
    --border-color: #bdc3c7;
    --text-color: #2c3e50;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-color);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: var(--primary-color);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 40px;
}

section {
    margin-bottom: 40px;
}

section h2 {
    color: var(--primary-color);
    font-size: 1.5em;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
}

section h3 {
    color: var(--primary-color);
    font-size: 1.2em;
    margin-bottom: 15px;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-color);
}

.form-group input,
.form-group select {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Grades Container */
.grades-container {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.grade-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 15px;
    margin-bottom: 15px;
    align-items: flex-end;
    padding: 15px;
    background: white;
    border-radius: 5px;
    border-left: 4px solid var(--secondary-color);
}

.grade-row label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9em;
}

.grade-row input {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
}

.grade-row button {
    padding: 8px 12px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
}

.optional-bonus {
    font-weight: 700;
    color: var(--secondary-color);
}

.grade-row.optional {
    background: linear-gradient(90deg, rgba(243,156,18,0.06), rgba(255,255,255,0));
    border-left-color: var(--warning-color);
}

.optional-detail {
    margin-top: 15px;
    background: #fff;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.optional-detail table {
    width: 100%;
    border-collapse: collapse;
}

.optional-detail th, .optional-detail td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--light-bg);
    text-align: left;
}

.optional-detail th {
    background: var(--light-bg);
    font-weight: 700;
}

.grade-row button:hover {
    background: #c0392b;
}

/* Button Styles */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-color);
}

.btn-secondary:hover {
    background: #95a5a6;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #229954;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.actions-section {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Results Section */
.results-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.result-box,
.decision-box {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 5px;
    border: 2px solid var(--secondary-color);
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.05em;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item.highlight {
    background: white;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
    font-weight: bold;
    color: var(--secondary-color);
    font-size: 1.3em;
}

.decision-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.decision-item:last-of-type {
    border-bottom: none;
}

.decision-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.decision-buttons button {
    flex: 1;
}

.saved-message {
    color: var(--success-color);
    font-weight: bold;
    text-align: center;
    padding: 10px;
    background: rgba(39, 174, 96, 0.1);
    border-radius: 3px;
    margin-top: 10px;
}

/* Footer */
footer {
    background: var(--primary-color);
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        padding: 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .grade-row {
        grid-template-columns: 1fr;
    }

    .results-section {
        grid-template-columns: 1fr;
    }

    .actions-section {
        flex-direction: column;
    }

    .actions-section button {
        width: 100%;
    }

    .decision-buttons {
        flex-direction: column;
    }

    .decision-buttons button {
        width: 100%;
    }
}
