/* Font Import Moved to HTML for performance */

:root {
    /* Modern & Minimalist Palette */
    --primary-color: #3498DB;   /* Vibrant Blue */
    --primary-hover: #2980B9;
    --secondary-color: #27AE60; /* Green (Safe/Success) */
    --secondary-hover: #219150;
    --accent-color: #E67E22;    /* Orange (Reset/Warning) */
    --accent-hover: #D35400;
    --danger-color: #E74C3C;    /* Red (Delete) */
    
    --background-color: #F9FAFB; /* Very light grey for better contrast with white cards */
    --surface-color: #FFFFFF;    /* Pure White Cards */
    
    --text-color: #2C3E50;       /* Dark Blue-Grey (Text/Numbers) */
    --text-muted: #7F8C8D;       /* Medium Grey */
    --border-color: #E5E7EB;     /* Lighter Grey Border */
    
    --font-family: 'Poppins', sans-serif;
    --container-width: 1080px;
    --header-height: 70px; /* Slightly taller header */
    
    /* Powerful Shadows */
    --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);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 24px; 
    --radius-pill: 999px;
    
    --transition-base: all 0.2s ease-in-out;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove blue highlight on mobile */
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.7;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(#E5E7EB 1px, transparent 1px);
    background-size: 24px 24px; /* Subtle dot pattern */
}

/* Typography - Chrome Style */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    font-weight: 400; /* Google Sans is often lighter/cleaner */
    line-height: 1.2;
    letter-spacing: -0.5px;
}

h1 { 
    font-size: 3.5rem; /* Big Hero Text */
    text-align: center;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

h2 { 
    font-size: 2.25rem; 
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

h3 {
    font-size: 1.5rem;
    font-weight: 500;
}

p { 
    margin-bottom: 1.5rem; 
    color: var(--text-muted);
    font-size: 1.125rem; /* Slightly larger reading text */
}

a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

a:hover { 
    text-decoration: underline; 
}

/* Layout */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.site-header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #dadce0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo img {
    height: 32px;
    width: 32px;
    display: block;
}

.nav-menu {
    display: flex;
    gap: 32px;
    list-style: none;
}

.nav-link {
    color: var(--text-muted);
    font-weight: 600; /* Made BOLD as requested */
    font-size: 0.95rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
    text-decoration: none;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Cards */
.card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 2rem;
    border: 1px solid rgba(0,0,0,0.03);
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}

.subject-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 48px;
    gap: 16px;
    align-items: center;
    background: #fff;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.subject-row:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

input, select {
    width: 100%;
    padding: 14px 16px; /* Larger touch target */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-color);
    background-color: #FAFAFA;
    transition: var(--transition-base);
    appearance: none; /* Modern Reset */
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15); /* Soft Glow */
    background-color: #fff;
}

.remove-btn {
    background: #FEE2E2; /* Soft Red Background */
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
}

.remove-btn:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition-base);
    border: none;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(52, 152, 219, 0.39);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.23);
    transform: translateY(-2px);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.btn-outline:hover {
    background: var(--secondary-color);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(39, 174, 96, 0.39);
    text-decoration: none;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(230, 126, 34, 0.39);
}

.btn-danger:hover {
    background: var(--accent-hover);
    text-decoration: none;
    transform: translateY(-2px);
}

.calc-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

/* Result Card */
.result-card {
    margin-top: 32px;
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: none; /* Hidden by default */
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bouncy reveal */
}

.result-card.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.gwa-value {
    font-size: 5rem;
    font-weight: 600;
    color: var(--primary-color);
    line-height: 1;
    margin: 16px 0;
    text-shadow: 0 4px 10px rgba(52, 152, 219, 0.2);
}

.gwa-remark {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    min-width: 600px; /* Force scroll on mobile */
}

th, td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #FAFAFA;
}

/* Utility */
.text-center { text-align: center; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 3rem; }
.mt-3 { margin-top: 1rem; }
.mt-5 { margin-top: 3rem; }
.fw-bold { font-weight: 600; }
.text-decoration-none { text-decoration: none; }

/* Footer */
.site-footer {
    background: #f8f9fa;
    color: var(--text-muted);
    padding: 4rem 0 2rem;
    border-top: 1px solid #e8eaed;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-section h3 {
    color: var(--text-color);
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 400;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.copyright {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #dadce0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    h1 { font-size: 2rem; margin-top: 1.5rem; }
    h2 { font-size: 1.75rem; margin-top: 2rem; }
    
    .gwa-value { font-size: 3.5rem; }

    .container { padding: 0 16px; }
    
    .card {
        padding: 24px;
        border-radius: 16px;
        box-shadow: var(--shadow-sm); /* Lighter shadow on mobile for performance */
    }
    
    .subject-row {
        grid-template-columns: 1fr 1fr 48px; /* Units | Grade | Remove */
        grid-template-areas: 
            "subject subject subject"
            "units grade remove";
        gap: 12px;
        padding: 16px;
    }

    /* Target the first child (Subject Input) to span full width */
    .subject-row > *:nth-child(1) {
        grid-area: subject;
    }
    .subject-row > *:nth-child(2) {
        grid-area: units;
    }
    .subject-row > *:nth-child(3) {
        grid-area: grade;
    }
    .subject-row > *:nth-child(4) {
        grid-area: remove;
        justify-self: end;
    }

    .calc-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }

    .hamburger {
        display: block;
        padding: 8px; /* Larger touch target */
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background: #fff;
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        gap: 0;
        border-top: 1px solid var(--border-color);
        animation: slideDown 0.3s ease-in-out;
    }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .nav-link {
        display: block;
        padding: 16px;
        font-size: 1.125rem;
        border-bottom: 1px solid #f1f3f4;
        color: var(--text-color);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* New Utilities for Resources Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.hover-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: block;
    height: 100%;
}

.hover-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.hover-card:hover h3 {
    text-decoration: underline;
}
