* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gradient-1);
    min-height: 100vh;
    padding: 2rem 1rem;
    color: var(--text-primary);
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.3) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Navigation */
nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 1rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.nav-links a.active {
    background: var(--primary-color);
    color: white;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    margin-bottom: 0.25rem;
}

.subtitle-note {
    font-size: 1rem;
    opacity: 0.9;
    font-style: italic;
}

.calculator-wrapper {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

section {
    margin-bottom: 2.5rem;
}

h2 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

h2::before {
    content: '';
    width: 4px;
    height: 1.75rem;
    background: var(--gradient-1);
    border-radius: 2px;
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.info-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Subject List */
.subject-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.subject-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: white;
}

.subject-item:hover {
    border-color: var(--primary-color);
    background: #f8faff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.subject-item.selected {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    box-shadow: var(--shadow-md);
}

.subject-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    cursor: pointer;
}

.subject-info {
    flex: 1;
}

.subject-name {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.subject-units {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.units-counter {
    text-align: right;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
    font-size: 1.1rem;
}

/* School Ranking */
.school-ranking {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px dashed var(--border-color);
}

.school-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.school-input-group label {
    font-weight: 600;
    color: var(--text-primary);
}

.school-input-group select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

.school-input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.school-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    padding: 0.5rem;
    background: white;
    border-radius: 6px;
}

/* Marks Entry */
.selected-subjects {
    display: grid;
    gap: 1rem;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.mark-input-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.mark-input-row label {
    font-weight: 600;
}

.mark-input-row input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
}

.mark-input-row input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-primary::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;
}

.btn-primary:hover:not(:disabled)::before {
    left: 100%;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

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

/* Results */
.results {
    border-top: 2px solid var(--border-color);
    padding-top: 2rem;
}

.results.hidden {
    display: none;
}

.atar-display {
    background: var(--gradient-1);
    color: white;
    padding: 3rem 2rem;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.atar-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.atar-label {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.atar-value {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.atar-range {
    font-size: 1.1rem;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

/* Breakdown */
.breakdown {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.subject-breakdown {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.breakdown-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    align-items: center;
}

.breakdown-item.counted {
    border-left: 4px solid var(--success-color);
}

.breakdown-item.not-counted {
    opacity: 0.6;
}

.breakdown-subject {
    font-weight: 600;
}

.breakdown-value {
    text-align: right;
}

.breakdown-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-counted {
    background: #d1fae5;
    color: #065f46;
}

.badge-not-counted {
    background: #f1f5f9;
    color: var(--text-secondary);
}

.aggregate-info {
    text-align: center;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
    font-size: 1.1rem;
}

/* Target Calculator */
.target-calculator {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
}

.target-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.target-input-group label {
    font-weight: 600;
}

.target-input-group input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.target-input-group button {
    margin-top: 0.5rem;
}

.target-results {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
}

.target-results.hidden {
    display: none;
}

.target-results p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Disclaimer */
.disclaimer {
    margin-top: 2rem;
    padding: 1rem;
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    border-radius: 8px;
    font-size: 0.9rem;
    color: #78350f;
}

/* About Page */
.about-section {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.about-section h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.about-section p {
    line-height: 1.8;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.about-section ul {
    list-style: none;
    padding: 0;
}

.about-section li {
    padding: 0.75rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.about-section li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.feature-card {
    background: linear-gradient(135deg, #f8faff 0%, #e0e7ff 100%);
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.feature-card h3::before {
    display: none;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.team-info {
    text-align: center;
    padding: 2rem;
    background: var(--gradient-1);
    color: white;
    border-radius: 16px;
    margin-top: 2rem;
}

.team-info h3 {
    color: white;
    margin-bottom: 1rem;
}

.team-info h3::before {
    display: none;
}

.team-info p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }

    header h1 {
        font-size: 2rem;
    }

    .calculator-wrapper {
        padding: 1.5rem;
    }

    .subject-list {
        grid-template-columns: 1fr;
    }

    .mark-input-row {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .breakdown-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .breakdown-value {
        text-align: left;
    }

    .atar-value {
        font-size: 3rem;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }
}
