/* WASSCE Grade Calculator - Clean Professional Styles */

:root {
    --primary: #0b3954;
    --secondary: #087e8b;
    --accent: #bfd7ea;
    --highlight: #ff5a5f;
    --error: #db3d6c;
    --success: #28a745;
    --background-color: #fff;
    --text-dark: #2c3e50;
    --text-light: #6c757d;
    --text-muted: #9ca3af;
    --border-light: #e5e7eb;
    --border-color: #d1d5db;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.2s ease;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
}

/* Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

.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;
}

/* Main Container */
.calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-md);
    font-family: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
}

/* Header Section */
.calculator-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    padding: var(--spacing-xl) 0;
}

.header-content h1 {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--spacing-md);
    line-height: 1.2;
}

.subtitle {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    color: var(--text-light);
    margin-bottom: var(--spacing-xl);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.info-button {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--accent);
    color: var(--primary);
    border: 2px solid transparent;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.info-button:hover,
.info-button:focus {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    outline: none;
}

.info-button:focus {
    box-shadow: 0 0 0 3px rgba(11, 57, 84, 0.2);
}

/* Progress Indicator */
.progress-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-2xl);
    padding: 0 var(--spacing-lg);
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0.6;
    transition: var(--transition);
}

.progress-step.active,
.progress-step.completed {
    opacity: 1;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border-light);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: var(--spacing-sm);
    transition: var(--transition);
    border: 2px solid var(--border-light);
}

.progress-step.active .step-number {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.progress-step.completed .step-number {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.progress-step span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dark);
}

.progress-line {
    width: 80px;
    height: 2px;
    background: var(--border-light);
    margin: 0 var(--spacing-md);
    position: relative;
    top: -18px;
}

/* Form Sections */
.calculator-form {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-2xl);
    box-shadow: var(--shadow-sm);
}

.form-section {
    margin-bottom: var(--spacing-2xl);
}

.form-section:last-child {
    margin-bottom: 0;
}

.section-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.section-header h2 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.section-description {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.elective-counter {
    margin-top: var(--spacing-md);
}

.counter-text {
    background: var(--accent);
    color: var(--primary);
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

/* Subject Cards Grid */
.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

.subject-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    transition: var(--transition);
    position: relative;
}

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

.subject-card:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 57, 84, 0.1);
}

.subject-card.selected {
    border-color: var(--secondary);
    background: rgba(8, 126, 139, 0.02);
}

.subject-card.completed {
    border-color: var(--success);
    background: rgba(40, 167, 69, 0.02);
}

/* Core Subject Cards */
.core-subject {
    border-color: var(--primary);
    background: rgba(11, 57, 84, 0.02);
}

.subject-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.subject-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.subject-type {
    background: var(--primary);
    color: white;
    padding: 0.125rem var(--spacing-sm);
    border-radius: 6px;
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.elective-subject .subject-type {
    background: var(--secondary);
}

/* Elective Subject Cards */
.elective-subject {
    border-color: var(--secondary);
    background: rgba(8, 126, 139, 0.02);
}

.elective-subject .subject-name {
    color: var(--text-muted);
    font-style: italic;
}

.elective-subject.selected .subject-name {
    color: var(--text-dark);
    font-style: normal;
    font-weight: 600;
}

/* Form Controls */
.grade-selector,
.subject-selector {
    width: 100%;
}

.grade-select,
.subject-select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-family: inherit;
    background: white;
    color: var(--text-dark);
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right var(--spacing-sm) center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

.grade-select:focus,
.subject-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 57, 84, 0.1);
}

.grade-select:disabled,
.subject-select:disabled {
    background-color: #f9fafb;
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Action Buttons */
.form-actions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: center;
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--border-light);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-xl);
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    min-width: 200px;
    min-height: 44px;
    position: relative;
    font-family: inherit;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(11, 57, 84, 0.2);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--secondary);
    border-color: var(--secondary);
}

.btn-primary:disabled {
    background: var(--text-muted);
    border-color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: var(--accent);
    color: var(--primary);
    border-color: var(--accent);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-loading {
    display: none;
    align-items: center;
    gap: var(--spacing-sm);
}

.btn-loading.active {
    display: flex;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Educational Content - Blog Style */
.educational-content {
    margin-top: var(--spacing-2xl);
    padding: var(--spacing-2xl) var(--spacing-xl);
    background: white;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-light);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.content-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 2px solid var(--border-light);
}

.content-header h2 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--spacing-md);
    line-height: 1.3;
}

.content-intro {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

.blog-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-dark);
}

.blog-section {
    margin-bottom: var(--spacing-2xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--border-light);
}

.blog-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.blog-section h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--spacing-md);
    line-height: 1.4;
}

.blog-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: var(--spacing-sm);
}

.blog-section h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.blog-section p {
    margin-bottom: var(--spacing-md);
    line-height: 1.7;
}

.blog-section ul,
.blog-section ol {
    margin-bottom: var(--spacing-md);
    padding-left: var(--spacing-xl);
}

.blog-section li {
    margin-bottom: var(--spacing-xs);
    line-height: 1.6;
}

/* Highlight Boxes */
.highlight-box {
    background: linear-gradient(135deg, var(--accent), rgba(191, 215, 234, 0.7));
    border: 1px solid var(--secondary);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
}

.highlight-box h4 {
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
}

.highlight-box p {
    margin-bottom: 0;
    color: var(--text-dark);
}

/* Grade Table */
.grade-table {
    background: #f8fafc;
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
    border: 1px solid var(--border-light);
}

.grade-row {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: var(--spacing-md);
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.grade-row:last-child {
    border-bottom: none;
}

.grade {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.125rem;
    min-width: 40px;
}

.points {
    font-weight: 600;
    color: var(--secondary);
    min-width: 80px;
}

.description {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Step Container */
.step-container {
    margin: var(--spacing-xl) 0;
}

.step-item {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: #f8fafc;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary);
}

.step-number {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h4 {
    margin-bottom: var(--spacing-sm);
    color: var(--primary);
}

.step-content p {
    margin-bottom: var(--spacing-sm);
}

.step-content ul {
    margin-bottom: var(--spacing-sm);
}

/* Formula Box */
.formula-box {
    background: var(--primary);
    color: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    text-align: center;
    margin: var(--spacing-md) 0;
    font-size: 0.875rem;
}

/* Example Box */
.example-box {
    background: #f0f9ff;
    border: 2px solid var(--accent);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
}

.example-box h4 {
    color: var(--primary);
    margin-bottom: var(--spacing-md);
}

.example-grades {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.subject-group h5 {
    color: var(--secondary);
    margin-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: var(--spacing-xs);
}

.subject-group ul {
    margin-bottom: 0;
}

.calculation {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
}

.calculation h5 {
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.calculation p {
    margin-bottom: var(--spacing-xs);
    font-family: 'Courier New', monospace;
}

/* Score Ranges */
.score-ranges {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.score-range {
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    border: 2px solid;
    text-align: center;
}

.score-range.excellent {
    border-color: var(--success);
    background: rgba(40, 167, 69, 0.05);
}

.score-range.good {
    border-color: var(--secondary);
    background: rgba(8, 126, 139, 0.05);
}

.score-range.fair {
    border-color: var(--highlight);
    background: rgba(255, 90, 95, 0.05);
}

.score-range.poor {
    border-color: var(--error);
    background: rgba(219, 61, 108, 0.05);
}

.score-range h4 {
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
}

.score-range.excellent h4 {
    color: var(--success);
}

.score-range.good h4 {
    color: var(--secondary);
}

.score-range.fair h4 {
    color: var(--highlight);
}

.score-range.poor h4 {
    color: var(--error);
}

/* Tips List */
.tips-list {
    background: #f8fafc;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--secondary);
    margin: var(--spacing-lg) 0;
}

.tips-list li {
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.tips-list li:last-child {
    margin-bottom: 0;
}

/* FAQ Items */
.faq-item {
    background: #f8fafc;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

.faq-item:last-child {
    margin-bottom: 0;
}

.faq-item h4 {
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.faq-item p {
    margin-bottom: 0;
    line-height: 1.6;
}

/* SweetAlert Accessibility Improvements */
.swal-accessible {
    font-family: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.swal-button-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.swal-button-primary:hover,
.swal-button-primary:focus {
    background-color: var(--secondary) !important;
    border-color: var(--secondary) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-container {
        padding: var(--spacing-md) var(--spacing-sm);
    }
    
    .progress-indicator {
        padding: 0;
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .progress-line {
        width: 2px;
        height: 40px;
        margin: 0;
        top: 0;
        transform: rotate(90deg);
        display: none; /* Hide on mobile for cleaner look */
    }
    
    .progress-step {
        flex-direction: row;
        align-items: center;
        gap: var(--spacing-sm);
        width: 100%;
        max-width: 200px;
    }
    
    .progress-step span {
        font-size: 0.875rem;
        margin-bottom: 0;
    }
    
    .step-number {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .calculator-form {
        padding: var(--spacing-lg);
    }
    
    .subjects-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        max-width: 320px;
    }
    
    .educational-content {
        padding: var(--spacing-lg) var(--spacing-md);
        margin-top: var(--spacing-xl);
    }
    
    .step-item {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-md);
    }
    
    .example-grades {
        grid-template-columns: 1fr;
    }
    
    .score-ranges {
        grid-template-columns: 1fr;
    }
    
    .grade-row {
        grid-template-columns: auto 1fr;
        gap: var(--spacing-sm);
    }
    
    .grade-row .points {
        grid-column: 1;
        grid-row: 2;
        font-size: 0.75rem;
    }
    
    .grade-row .description {
        grid-column: 2;
        grid-row: span 2;
    }
}

@media (max-width: 480px) {
    .subject-card {
        padding: var(--spacing-md);
    }
    
    .subject-info {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
        margin-bottom: var(--spacing-sm);
    }
    
    .progress-step {
        justify-content: center;
        text-align: center;
    }
    
    .progress-step span {
        font-size: 0.75rem;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .progress-indicator {
        gap: var(--spacing-sm);
    }
    
    .header-content h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 0.875rem;
    }
    
    .educational-content {
        padding: var(--spacing-md);
    }
    
    .blog-section {
        margin-bottom: var(--spacing-xl);
        padding-bottom: var(--spacing-md);
    }
    
    .step-item {
        padding: var(--spacing-md);
    }
    
    .formula-box {
        font-size: 0.75rem;
        padding: var(--spacing-sm);
    }
    
    .content-header h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .subject-card {
        padding: var(--spacing-md);
    }
    
    .subject-info {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
        margin-bottom: var(--spacing-sm);
    }
    
    .progress-step {
        justify-content: center;
        text-align: center;
    }
    
    .progress-step span {
        font-size: 0.75rem;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .progress-indicator {
        gap: var(--spacing-sm);
    }
    
    .header-content h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 0.875rem;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --text-light: #000;
        --text-muted: #333;
    }
    
    .subject-card {
        border-width: 3px;
    }
    
    .btn {
        border-width: 3px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .spinner {
        animation: none;
    }
}

/* Focus Management */
.focus-trap {
    position: relative;
}

/* Print Styles */
@media print {
    .calculator-container {
        max-width: none;
        padding: 0;
    }
    
    .info-button,
    .btn {
        display: none;
    }
    
    .educational-content {
        background: white;
        border: none;
        box-shadow: none;
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .calculator-form {
        display: none;
    }
    
    .calculator-header {
        margin-bottom: var(--spacing-md);
    }
    
    .blog-section {
        page-break-inside: avoid;
        margin-bottom: var(--spacing-lg);
    }
    
    .step-item,
    .example-box,
    .highlight-box {
        page-break-inside: avoid;
    }
    
    .content-header h2 {
        color: black;
    }
    
    .blog-section h3,
    .blog-section h4,
    .blog-section h5 {
        color: black;
    }
}
