:root {
    --primary: #ff4d4d;
    --primary-hover: #ff3333;
    --bg-dark: #0a0a0c;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-dim: #a0a0a8;
    --success: #00ff88;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(255, 77, 77, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* Header & Nav */
header {
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

.red-text { color: var(--primary); }

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    margin-left: 24px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-main);
}

/* Container */
.container {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.header-section {
    text-align: center;
    margin-bottom: 40px;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.gradient-text {
    background: linear-gradient(90deg, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-section p {
    color: var(--text-dim);
    font-size: 1.1rem;
}

/* Tabs */
.tabs {
    display: flex;
    padding: 6px;
    margin-bottom: 24px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* Calculator Card */
.calculator-card {
    padding: 32px;
    margin-bottom: 40px;
    animation: slideUp 0.6s ease-out;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    font-weight: 500;
}

select, input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
}

select:focus, input:focus {
    border-color: var(--primary);
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-bottom: 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--glass-border);
}

.subject-input { width: 100%; min-width: 200px; }
.credit-input { width: 80px; text-align: center; }
.grade-select { width: 100px; }

.delete-btn {
    background: transparent;
    border: none;
    color: #ff4d4d88;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    color: var(--primary);
    background: rgba(255, 77, 77, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

/* Result Card */
.result-card {
    margin-top: 32px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(135deg, rgba(255, 77, 77, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.result-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.result-info .label {
    color: var(--text-dim);
    font-size: 1rem;
}

.result-info .value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* CGPA Grid */
.cgpa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.semester-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.semester-box label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.semester-box.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Footer */
footer {
    text-align: center;
    padding: 24px;
    margin-top: auto;
    color: var(--text-dim);
    font-size: 0.9rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
}

/* Helpers */
.hidden { display: none; }
.fade-in { animation: fadeIn 0.5s ease-in; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Mobile Responsive */
@media (max-width: 600px) {
    h1 { font-size: 2rem; }
    .calculator-card { padding: 20px; }
    .result-info .value { font-size: 2rem; }
    .nav-links { display: none; }
}
