/* ============================================
   LASU Aggregate Calculator — LAMP EDTECH
   Developed by Afolabi Samuel Oluwaseun
   ============================================ */

/* CSS Custom Properties */
:root {
    --primary-color: #0a3d62;
    --primary-dark: #083050;
    --primary-light: #1e5a8a;
    --secondary-color: #e8f0fe;
    --accent-color: #0f6b3a;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --text-dark: #1e293b;
    --text-medium: #475569;
    --text-light: #64748b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 50px rgba(0, 20, 50, 0.2);
    --gradient-bg: linear-gradient(145deg, #f0f4ff 0%, #e6edf7 50%, #f8faff 100%);
    --border-radius-sm: 0.75rem;
    --border-radius-md: 1.25rem;
    --border-radius-lg: 2rem;
    --border-radius-xl: 2.5rem;
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--gradient-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    margin: 0;
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Skip Link (Accessibility) */
.skip-link {
    position: absolute;
    left: -9999px;
    top: -9999px;
    z-index: 999;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
}

.skip-link:focus {
    left: 1rem;
    top: 1rem;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Container */
.container {
    max-width: 780px;
    width: 100%;
    background: var(--bg-white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem 2.2rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
    position: relative;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-text {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.header h1 {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
    letter-spacing: -0.5px;
    line-height: 1.3;
}

.subtitle {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.header-description {
    font-size: 0.9rem;
    color: var(--text-medium);
    max-width: 600px;
    margin: 0 auto;
}

/* Grade Reference Section */
.grade-reference {
    background: linear-gradient(135deg, #f8fafd 0%, #edf2f9 100%);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.grade-reference h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 0.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
    min-width: 400px;
}

th,
td {
    padding: 0.7rem 0.5rem;
    text-align: center;
    border: 1px solid var(--border-light);
    font-weight: 500;
}

thead th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

tbody th {
    background: #f1f5f9;
    font-weight: 600;
    color: var(--primary-dark);
}

.table-note {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.8rem;
    font-style: italic;
}

/* Form Sections */
.form-section {
    margin-bottom: 1.8rem;
}

.form-section label {
    font-weight: 700;
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-section input[type="text"],
.form-section input[type="number"],
.form-section select {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    background: var(--bg-white);
    transition: all var(--transition-fast);
    color: var(--text-dark);
}

.form-section input:focus,
.form-section select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(15, 76, 117, 0.1);
    background: #fafcff;
}

.form-section input::placeholder {
    color: #94a3b8;
    font-weight: 300;
}

.hint-text {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.4rem;
    display: block;
    transition: color var(--transition-fast);
}

.hint-text.valid {
    color: var(--accent-color);
    font-weight: 600;
}

/* Subjects Container */
.subjects-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin: 0.8rem 0 1rem;
}

.subject-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #f9fbfd;
    padding: 0.6rem 0.9rem;
    border-radius: var(--border-radius-md);
    border: 1.5px solid var(--border-color);
    transition: all var(--transition-fast);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.subject-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-sm);
}

.subject-name {
    flex: 2;
    min-width: 130px;
    padding: 0.65rem 1rem !important;
    font-size: 0.9rem !important;
}

.subject-grade {
    flex: 1;
    min-width: 100px;
    padding: 0.65rem 0.8rem !important;
    font-size: 0.9rem !important;
}

.remove-subject-btn {
    background: #fee2e2;
    border: 1.5px solid #fecaca;
    color: var(--danger-color);
    padding: 0.55rem 1rem;
    border-radius: 2rem;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-family: 'Poppins', sans-serif;
}

.remove-subject-btn:hover {
    background: #fecaca;
    border-color: #fca5a5;
    transform: translateY(-1px);
}

.remove-subject-btn:active {
    transform: translateY(0);
}

/* Add Subject Button */
.add-subject-btn {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 2px dashed var(--primary-light);
    color: var(--primary-color);
    padding: 0.8rem 1.5rem;
    border-radius: 2.5rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all var(--transition-smooth);
    margin-top: 0.3rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
}

.add-subject-btn:hover:not(:disabled) {
    background: #dbeafe;
    border-style: solid;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.add-subject-btn:active:not(:disabled) {
    transform: translateY(0);
}

.add-subject-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.subject-count-status {
    font-weight: 500;
    min-height: 20px;
}

/* Calculate Button */
.calculate-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0c4a6e 100%);
    color: white;
    font-weight: 700;
    font-size: 1.15rem;
    padding: 1.1rem 2rem;
    border: none;
    border-radius: 3rem;
    width: 100%;
    cursor: pointer;
    margin: 1.5rem 0 2rem;
    transition: all var(--transition-smooth);
    letter-spacing: 0.3px;
    box-shadow: 0 8px 20px rgba(8, 45, 72, 0.3);
    font-family: 'Poppins', sans-serif;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.calculate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.calculate-btn:hover::before {
    left: 100%;
}

.calculate-btn:hover {
    background: linear-gradient(135deg, #0c4a6e 0%, #0f5e8a 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(8, 45, 72, 0.4);
}

.calculate-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(8, 45, 72, 0.3);
}

/* Result Container */
.result-container {
    background: linear-gradient(135deg, #f0f7fe 0%, #e8f3ff 100%);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-top: 1.2rem;
    display: none;
    border: 1px solid #cbddf2;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-container.show {
    display: block;
}

.result-header h2 {
    font-size: 1.3rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 700;
}

.aggregate-score-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.3rem;
    margin: 1rem 0;
}

.aggregate-number {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--primary-color);
    line-height: 1;
    font-family: 'Montserrat', sans-serif;
}

.aggregate-symbol {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.breakdown-container {
    margin-top: 1.5rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0;
    border-bottom: 1px solid #dce5f0;
    font-size: 0.9rem;
}

.breakdown-item:last-of-type {
    border-bottom: none;
}

.breakdown-label {
    font-weight: 500;
    color: var(--text-medium);
}

.breakdown-value {
    font-weight: 700;
    color: var(--primary-dark);
}

.result-note {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px dashed #cbddf2;
    font-size: 0.85rem;
    color: var(--text-medium);
    text-align: center;
}

.result-note a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.footer-content p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-medium);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.2rem;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition-fast);
    border: 1.5px solid transparent;
}

.portfolio-link {
    background: #eef2ff;
    color: var(--primary-color);
    border-color: #c7d2fe;
}

.portfolio-link:hover {
    background: #dbeafe;
    transform: translateY(-2px);
}

.whatsapp-link {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.whatsapp-link:hover {
    background: #bbf7d0;
    transform: translateY(-2px);
}

.footer-legal {
    margin: 0.8rem 0;
}

.privacy-link {
    color: var(--text-light);
    font-size: 0.8rem;
    text-decoration: underline;
}

.footer-copyright {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1.8rem 1.2rem;
        border-radius: var(--border-radius-lg);
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .subject-card {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .subject-name,
    .subject-grade {
        width: 100%;
        min-width: auto;
    }

    .remove-subject-btn {
        align-self: flex-end;
    }

    .aggregate-number {
        font-size: 2.8rem;
    }

    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.8rem;
    }

    .container {
        padding: 1.2rem 0.9rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .calculate-btn {
        font-size: 1rem;
        padding: 0.9rem 1.5rem;
    }

    .aggregate-number {
        font-size: 2.5rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .container {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .calculate-btn,
    .add-subject-btn,
    .remove-subject-btn {
        display: none;
    }
}