/* All of our CSS from the old <style> block */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: #f0f2f5; 
    margin: 0; 
    padding: 0; 
}
.navbar { 
    background: white; 
    padding: 1rem 2rem; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    text-align: center; /* Center the title */
}
.navbar h1 {
    margin: 0;
    color: #764ba2;
    font-size: 1.5rem;
}
.content { 
    padding: 2rem; 
    max-width: 800px; 
    margin: 20px auto; 
    background: white; 
    border-radius: 10px; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); 
}

/* Styles for the calculator */
.gpa-form { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
}
.form-group { 
    margin-bottom: 1rem; 
}
label { 
    display: block; 
    margin-bottom: 0.5rem; 
    color: #666; 
    font-size: 0.9rem; 
}
input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
}

/* Help text styling */
.help-text {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-top: 4px;
    font-style: italic;
}

/* Required field indicator */
.required {
    color: #dc3545;
    font-weight: bold;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for accessibility */
input:focus,
button:focus,
select:focus {
    outline: 3px solid #764ba2;
    outline-offset: 2px;
}

/* Scale selector styling */
.scale-selector {
    grid-column: 1 / -1;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    border: 2px solid #764ba2;
    margin-bottom: 10px;
}

.scale-selector select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.scale-selector select:hover {
    border-color: #764ba2;
}

#gpa-calculator button {
    /* Make the button span both columns */
    grid-column: 1 / -1; 
    padding: 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    color: white;
}
#calcBtn {
    background: #28a745; /* Green */
}

.secondary-btn {
    grid-column: 1 / -1;
    padding: 10px;
    border: 2px solid #dc3545;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    color: #dc3545;
    margin-top: 10px;
}

.secondary-btn:hover {
    background: #dc3545;
    color: white;
}

/* Share button variant */
.share-btn {
    border-color: #007bff;
    color: #007bff;
}

.share-btn:hover {
    background: #007bff;
    color: white;
}
/* Error Messages */
.error-container {
    grid-column: 1 / -1;
    margin-top: 10px;
}

.error {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 5px;
    border-left: 4px solid #c62828;
    font-size: 0.9rem;
}

.error::before {
    content: "⚠️ ";
}

/* Result Display */
#gpa-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    display: none;
    grid-column: 1 / -1;
}

/* History Styles */
.history-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-header h3 {
    margin: 0;
    color: #764ba2;
}

.clear-history-btn {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
}

.clear-history-btn:hover {
    background: #c82333;
}

.empty-history {
    text-align: center;
    color: #666;
    padding: 20px;
    font-style: italic;
}

.history-list {
    display: grid;
    gap: 15px;
}

.history-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 15px;
    align-items: start;
    transition: box-shadow 0.2s;
}

.history-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.history-item.impossible {
    border-left: 4px solid #dc3545;
}

.history-item.achievable {
    border-left: 4px solid #28a745;
}

.history-time {
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
}

.history-details {
    display: grid;
    gap: 5px;
}

.history-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9rem;
}

.history-row .label {
    color: #666;
    font-weight: 500;
}

.history-row .value {
    font-weight: bold;
    color: #333;
}

.history-row .value.result {
    color: #764ba2;
    font-size: 1.1rem;
}

.history-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.history-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
}

.load-btn {
    background: #764ba2;
    color: white;
}

.load-btn:hover {
    background: #5a3779;
}

.delete-btn {
    background: #f8f9fa;
    color: #dc3545;
    border: 1px solid #dc3545;
    font-size: 1.2rem;
    padding: 2px 8px;
}

.delete-btn:hover {
    background: #dc3545;
    color: white;
}

/* Responsive */
@media (max-width: 600px) {
    .history-item {
        grid-template-columns: 1fr;
    }

    .history-actions {
        flex-direction: row;
    }
}

/* Mode Selector */
.mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
}

.mode-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    border-color: #764ba2;
    color: #764ba2;
}

.mode-btn.active {
    background: #764ba2;
    border-color: #764ba2;
    color: white;
}

.calculator-mode {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Course Calculator */
.course-calculator {
    margin-top: 20px;
}

.course-list {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.empty-courses {
    text-align: center;
    color: #666;
    padding: 30px;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 5px;
}

.course-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #ddd;
    align-items: center;
    transition: box-shadow 0.2s;
}

.course-row:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.course-row input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.course-row input:focus {
    outline: 2px solid #764ba2;
    outline-offset: 1px;
}

.course-name {
    font-weight: 500;
}

.course-grade,
.course-credits {
    text-align: center;
}

.remove-course-btn {
    padding: 6px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: background 0.2s;
}

.remove-course-btn:hover {
    background: #c82333;
}

.add-course-btn {
    width: 100%;
    padding: 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background 0.2s;
}

.add-course-btn:hover {
    background: #218838;
}

/* Semester Results */
.semester-result {
    margin-top: 25px;
    padding: 20px;
    background: #e8f5e9;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    display: none;
}

.semester-result h3 {
    margin: 0 0 15px 0;
    color: #2e7d32;
    font-size: 1.2rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #c8e6c9;
}

.result-row:last-child {
    border-bottom: none;
}

.result-label {
    color: #666;
    font-weight: 500;
}

.result-value {
    font-weight: bold;
    color: #2e7d32;
    font-size: 1.1rem;
}

.result-scale {
    font-size: 0.85rem;
    color: #666;
    font-weight: normal;
}

/* Responsive - Course Calculator */
@media (max-width: 768px) {
    .mode-selector {
        flex-direction: column;
    }

    .course-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .course-row input {
        width: 100%;
    }

    .remove-course-btn {
        width: 100%;
        padding: 10px;
    }
}