:root {
    --primary: #2a52be;
    --success: #27ae60;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --dark: #2c3e50;
    --light-bg: #f4f7f6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: var(--light-bg); 
    color: var(--dark); 
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 40px auto; 
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

/* NAVIGATION */
.main-nav { background: #fff; border-bottom: 1px solid #eee; padding: 15px 0; }
.nav-container { max-width: 1000px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.4rem; font-weight: bold; }
.logo span { color: var(--primary); }
.nav-links { list-style: none; display: flex; gap: 20px; }
.nav-links a { text-decoration: none; color: var(--dark); font-weight: 500; transition: 0.3s; font-size: 0.95rem; }
.nav-links a:hover { color: var(--primary); }

/* STICKY DASHBOARD */
.sticky-wrapper {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white; /* Changed to white to blend with container */
    padding: 10px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.dashboard { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 15px; 
}

.stat-card { background: #fff; border: 1px solid #eee; padding: 15px; border-radius: 10px; text-align: center; transition: 0.2s; }
.stat-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.gpa-value { font-size: 2rem; font-weight: bold; color: var(--primary); line-height: 1.2; }
.status-indicator { font-size: 0.7rem; font-weight: bold; text-transform: uppercase; margin-top: 5px; min-height: 1rem; }
.status-indicator.good { color: var(--success); }
.status-indicator.okay { color: var(--warning); }
.status-indicator.bad { color: var(--danger); }

/* TABLE STRUCTURE */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 25px;
    border-radius: 8px;
    border: 1px solid #eee;
}

table { width: 100%; border-collapse: collapse; min-width: 700px; }
th { text-align: left; padding: 15px 12px; border-bottom: 2px solid #eee; color: #666; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
td { padding: 12px 10px; border-bottom: 1px solid #f9f9f9; vertical-align: middle; }

#gpaTable th:nth-child(2), #gpaTable td:nth-child(2) { width: 90px; text-align: center; }
#gpaTable th:nth-child(3), #gpaTable td:nth-child(3) { width: 100px; text-align: center; }
#gpaTable th:nth-child(4), #gpaTable td:nth-child(4) { width: 110px; text-align: center; }

input, select { padding: 10px; border: 1px solid #ddd; border-radius: 6px; width: 100%; font-size: 0.95rem; outline: none; transition: border 0.2s; }
input:focus, select:focus { border-color: var(--primary); }

.row-points { font-weight: bold; color: var(--dark); font-family: monospace; text-align: center; font-size: 1.1rem; display: block; }

.badge { padding: 6px 12px; border-radius: 4px; font-size: 0.8rem; font-weight: bold; color: white; display: inline-block; white-space: nowrap; }
.badge.sci { background: var(--primary); border-left: 4px solid #1a3a8a; }

/* CONTROLS */
.controls { display: flex; gap: 15px; margin: 20px 0; flex-wrap: wrap; }
.btn-primary { background: var(--primary); color: white; border: none; padding: 14px 25px; border-radius: 6px; cursor: pointer; font-weight: bold; flex: 1.5; transition: 0.3s; }
.btn-primary:hover { background: #1a3a8a; }
.btn-secondary { background: #fff; border: 1px solid #ccc; padding: 14px 25px; border-radius: 6px; cursor: pointer; flex: 1; transition: 0.3s; }
.btn-danger-outline { background: transparent; border: 1px solid var(--danger); color: var(--danger); padding: 14px 25px; border-radius: 6px; cursor: pointer; font-weight: bold; transition: 0.3s; }
.btn-danger-outline:hover { background: var(--danger); color: white; }
.btn-del { background: #fff1f1; color: var(--danger); border: 1px solid #ffcfcf; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; }

/* GOAL PLANNER */
.goal-section { margin-top: 40px; padding: 30px; background: #ffffff; border-radius: 16px; border: 1px solid #e0e7ff; box-shadow: 0 10px 30px rgba(42, 82, 190, 0.05); }
.goal-header { text-align: center; margin-bottom: 25px; }
.goal-header h3 { color: var(--primary); font-size: 1.4rem; }
.goal-header p { color: #666; font-size: 0.9rem; }
.goal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 25px; }
.goal-input-group label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--dark); margin-bottom: 8px; text-transform: uppercase; }
.goal-result-box { background: #f8faff; border: 1px dashed #adc6ff; border-radius: 12px; padding: 20px; text-align: center; font-size: 1.05rem; min-height: 60px; display: flex; align-items: center; justify-content: center; }
.goal-result-box strong { color: var(--primary); font-size: 1.2rem; margin: 0 5px; }

/* ANIMATIONS & STATES */
@keyframes pulse-red { 0% { transform: scale(1); } 50% { transform: scale(1.03); } 100% { transform: scale(1); } }
.goal-success { color: #1e7e34; background: #e8f5e9; padding: 4px 10px; border-radius: 6px; font-weight: bold; }
.goal-warning { color: #bd2130; background: #fdf2f2; padding: 4px 10px; border-radius: 6px; font-weight: bold; animation: pulse-red 2s infinite ease-in-out; }

/* SITE FOOTER */
.site-footer { background: #2c3e50; color: #ecf0f1; padding: 50px 0 0; margin-top: 80px; }
.footer-container { max-width: 1000px; margin: 0 auto; padding: 0 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; }
.footer-links ul { list-style: none; margin-top: 10px; }
.footer-links a { color: #bdc3c7; text-decoration: none; display: block; margin-bottom: 10px; font-size: 0.85rem; }
.footer-bottom { text-align: center; padding: 25px; border-top: 1px solid #3e4f5f; margin-top: 40px; color: #7f8c8d; font-size: 0.8rem; }

/* MEDIA QUERIES */
@media (max-width: 768px) {
    .container { padding: 20px; margin: 20px 10px; }
    .sticky-wrapper { position: relative; border: none; padding: 0; }
    .dashboard { grid-template-columns: 1fr; }
    .controls { flex-direction: column; }
    .btn-primary, .btn-secondary, .btn-danger-outline { width: 100%; flex: none; }
}

@media (max-width: 480px) {
    td:first-child, th:first-child { position: sticky; left: 0; background: white; z-index: 5; border-right: 2px solid #eee; }
}

@media print {
    .main-nav, .site-footer, .controls, .btn-del, .goal-section { display: none !important; }
    .container { width: 100%; max-width: 100%; margin: 0; padding: 0; box-shadow: none; border: none; }
    .dashboard { display: flex !important; justify-content: space-between; border-bottom: 2px solid #000; padding-bottom: 20px; }
    .badge { border: 1px solid #000 !important; color: #000 !important; background: transparent !important; }
}

/* NEW: Track Toggle Styling */
.track-toggle-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.toggle-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: #666;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.toggle-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(42, 82, 190, 0.2);
}

/* Enhancing Dropdown Visuals for BCPM/Science */
.category-select {
    cursor: pointer;
    background-color: #fcfcfc;
    border-left: 4px solid #ddd; /* Default border */
}

/* Styling specifically for when JS detects 'science' value */
.category-select[data-selected="science"] {
    border-left-color: var(--primary);
}

/* Accessibility: Hide elements smoothly */
#preGPA-card {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Ensure empty rows look clean */
input::placeholder {
    color: #ccc;
    font-style: italic;
}

/* Centers the cards when only 2 are visible (Pre-Med mode) */
.dashboard.centered-layout {
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* Ensure cards don't shrink too much in flex mode */
.dashboard.centered-layout .stat-card {
    min-width: 250px;
}