:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --error-color: #dc2626;
    --success-color: #059669;
    --bg-gradient-from: #eff6ff;
    --bg-gradient-to: #e0e7ff;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --border-color: #e5e7eb;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    background: linear-gradient(to bottom right, var(--bg-gradient-from), var(--bg-gradient-to));
    padding: 1rem;
    color: var(--text-primary);
}

.container {
    max-width: 64rem;
    margin: 0 auto;
}

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

.header .icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.header .icon svg {
    width: 3rem;
    height: 3rem;
    color: var(--primary-color);
}

.header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
}

.card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* Tab Styles */
.tab-container {
    padding: 0;
    overflow: hidden;
}

.tabs {
    display: flex;
    gap: 1px;
    background-color: #f3f4f6;
    border-radius: 0.75rem;
}

.tab-button {
    flex: 1;
    padding: 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.tab-button svg {
    width: 1.25rem;
    height: 1.25rem;
}

.tab-button.active {
    background-color: white;
    color: var(--primary-color);
}

.tab-button:hover:not(.active) {
    background-color: #e5e7eb;
}

.calculator-section {
    display: none;
}

.calculator-section.active {
    display: block;
}

.instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.instructions-content {
    color: var(--text-secondary);
}

.instructions-content p {
    margin-bottom: 0.5rem;
}

.subject-row,
.semester-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.button {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.button svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
}

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

.button.primary:hover {
    background: var(--primary-hover);
}

.button.secondary {
    background: #f3f4f6;
    color: var(--text-primary);
}

.button.secondary:hover {
    background: #e5e7eb;
}

.button.danger {
    color: var(--error-color);
    background: transparent;
}

.button.danger:hover {
    background: #fee2e2;
}

.error {
    background: #fee2e2;
    color: var(--error-color);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.result {
    background: #ecfdf5;
    color: var(--success-color);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-top: 1.5rem;
}

.result h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.percentage-result {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(5, 150, 105, 0.2);
}

.percentage-result h3 {
    font-size: 1.25rem;
    color: var(--success-color);
}

.grade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.grade-item {
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
}

.grade-item .grade {
    font-weight: 600;
    color: var(--text-primary);
}

.grade-item .points {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.hidden {
    display: none;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
}

.icon-button:hover {
    color: var(--primary-hover);
}

@media (max-width: 640px) {
    .header h1 {
        font-size: 1.875rem;
    }

    .card {
        padding: 1rem;
    }

    .button-group {
        flex-direction: column;
    }

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

    .tabs {
        flex-direction: column;
    }

    .tab-button {
        border-radius: 0;
    }
}