/* ===== CSS Reset & Variables ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette — Dark Green/Blue/Black */
    --primary: #00e5a0;
    --primary-light: #5ffbcb;
    --primary-dark: #00b87a;
    --accent: #00b4d8;
    --accent-light: #48cae4;
    --success: #10b981;
    --warning: #fbbf24;
    --danger: #f87171;
    --danger-light: #fca5a5;

    /* Background */
    --bg-dark: #0a0f0d;
    --bg-green: #0d2818;
    --bg-blue: #0a1628;

    /* Liquid Glass */
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --glass-glow: rgba(0, 229, 160, 0.08);

    /* Text */
    --text-primary: #e8f5f0;
    --text-secondary: #a0c4b8;
    --text-muted: #5a8a7a;
    --text-white: #ffffff;

    /* Sizing */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Base Styles ===== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(0, 180, 216, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 229, 160, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(0, 80, 120, 0.1) 0%, transparent 60%),
        linear-gradient(160deg, #050d09 0%, #0a1a12 25%, #0d2233 55%, #091a0f 80%, #030806 100%);
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
}

/* ===== Animated Background Orbs ===== */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.6;
    z-index: 0;
    pointer-events: none;
}

.bg-orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 229, 160, 0.2), transparent 70%);
    top: -150px;
    right: -100px;
    animation: orbFloat1 18s ease-in-out infinite;
}

.bg-orb-2 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, rgba(0, 180, 216, 0.2), transparent 70%);
    bottom: -100px;
    left: -120px;
    animation: orbFloat2 22s ease-in-out infinite;
}

.bg-orb-3 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(0, 150, 100, 0.15), transparent 70%);
    top: 50%;
    left: 60%;
    animation: orbFloat3 20s ease-in-out infinite;
}

.bg-orb-4 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 100, 200, 0.12), transparent 70%);
    top: 15%;
    left: 10%;
    animation: orbFloat4 15s ease-in-out infinite;
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-80px, 50px) scale(1.15); }
    66% { transform: translate(40px, -40px) scale(0.9); }
}

@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, -50px) scale(1.2); }
    66% { transform: translate(-50px, 40px) scale(0.95); }
}

@keyframes orbFloat3 {
    0%, 100% { transform: translate(-50%, 0) scale(1); }
    50% { transform: translate(-50%, -60px) scale(1.25); }
}

@keyframes orbFloat4 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -30px) scale(1.15); }
}

/* ===== Container ===== */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 30px 20px 60px;
    position: relative;
    z-index: 1;
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 36px;
    animation: fadeInDown 0.8s ease-out;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #030806;
    margin-bottom: 16px;
    box-shadow: 
        0 8px 40px rgba(0, 229, 160, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent-light), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ==========================================================
   LIQUID GLASS CARD
   - Ultra-transparent with color refraction
   - Multi-layer glow borders
   - Inner light caustics
   ========================================================== */
.glass-card {
    background: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 50%, rgba(0, 229, 160, 0.04) 100%);
    backdrop-filter: blur(24px) saturate(160%) brightness(1.1);
    -webkit-backdrop-filter: blur(24px) saturate(160%) brightness(1.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    padding: 28px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 48px rgba(0, 0, 0, 0.4),
        0 4px 16px rgba(0, 0, 0, 0.25),
        0 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04),
        0 0 60px rgba(0, 229, 160, 0.04),
        0 0 100px rgba(0, 180, 216, 0.03);
    transition: var(--transition-smooth);
}

/* Top edge light refraction - liquid glass shine */
.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg, 
        transparent 5%, 
        rgba(0, 229, 160, 0.3) 20%,
        rgba(255, 255, 255, 0.5) 50%, 
        rgba(0, 180, 216, 0.3) 80%,
        transparent 95%
    );
    pointer-events: none;
    z-index: 2;
}

/* Inner light caustic / liquid refraction overlay */
.glass-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(
        180deg, 
        rgba(255, 255, 255, 0.07) 0%, 
        rgba(255, 255, 255, 0.02) 40%,
        transparent 100%
    );
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    pointer-events: none;
    z-index: 1;
}

.glass-card:hover {
    background: 
        linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 50%, rgba(0, 229, 160, 0.06) 100%);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow:
        0 12px 56px rgba(0, 0, 0, 0.5),
        0 6px 20px rgba(0, 0, 0, 0.3),
        0 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05),
        0 0 80px rgba(0, 229, 160, 0.06),
        0 0 120px rgba(0, 180, 216, 0.04);
    transform: translateY(-2px);
}

/* ===== Form Card ===== */
.form-card {
    animation: fadeInUp 0.8s ease-out;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.card-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-header h2 svg {
    color: var(--primary);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(0, 229, 160, 0.2);
    background: rgba(0, 229, 160, 0.08);
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(0, 229, 160, 0.15);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 229, 160, 0.15);
}

.btn-icon:active {
    transform: scale(0.95);
}

/* ===== Subject Rows ===== */
.subjects-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 2;
}

.subject-row {
    display: grid;
    grid-template-columns: 1fr 100px 80px 36px;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: var(--transition-fast);
    animation: slideInRow 0.4s ease-out;
    backdrop-filter: blur(8px);
}

.subject-row:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(0, 229, 160, 0.15);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.subject-row.error {
    border-color: rgba(248, 113, 113, 0.4);
    animation: shake 0.4s ease-in-out;
}

@keyframes slideInRow {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.subject-row .row-number {
    display: none;
}

/* ===== Input fields (Dark theme) ===== */
.input-field {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition-fast);
    outline: none;
}

.input-field::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.input-field:focus {
    border-color: rgba(0, 229, 160, 0.4);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(0, 229, 160, 0.08), 0 0 20px rgba(0, 229, 160, 0.05);
}

.input-field.input-grade,
.input-field.input-credit {
    text-align: center;
    font-weight: 600;
}

/* Delete button */
.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.btn-delete:hover {
    background: rgba(248, 113, 113, 0.2);
    transform: scale(1.1);
}

.btn-delete:active {
    transform: scale(0.9);
}

/* ===== Add Subject Button ===== */
.btn-add-subject {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    border-radius: var(--radius-md);
    border: 2px dashed rgba(0, 229, 160, 0.15);
    background: rgba(0, 229, 160, 0.03);
    color: var(--primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    z-index: 2;
}

.btn-add-subject:hover {
    border-color: rgba(0, 229, 160, 0.3);
    background: rgba(0, 229, 160, 0.06);
    transform: translateY(-1px);
}

/* ===== Calculate Button ===== */
.btn-calculate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    margin-top: 20px;
    border-radius: var(--radius-md);
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, #00b87a 40%, var(--accent) 100%);
    background-size: 200% 200%;
    color: #030806;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    z-index: 2;
    overflow: hidden;
    box-shadow: 
        0 4px 24px rgba(0, 229, 160, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.btn-calculate::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.6s;
}

.btn-calculate:hover::after {
    left: 100%;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 36px rgba(0, 229, 160, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.btn-calculate:active {
    transform: translateY(0);
}

/* ===== Result Card ===== */
.result-card {
    animation: fadeInUp 0.6s ease-out;
    text-align: center;
}

.result-card.hidden {
    display: none;
}

.result-header h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.result-header h2 svg {
    color: var(--warning);
}

/* GPA Circle */
.gpa-display {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.gpa-circle {
    position: relative;
    width: 160px;
    height: 160px;
}

.gpa-ring {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.gpa-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.06);
    stroke-width: 8;
}

.gpa-ring-fill {
    fill: none;
    stroke: url(#gpaGradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gpa-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gpa-number {
    display: block;
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.gpa-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 4px;
}

/* GPA Status */
.gpa-status {
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
}

.gpa-status .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    animation: popIn 0.5s ease-out 0.3s both;
}

.status-excellent {
    background: rgba(16, 185, 129, 0.15);
    color: #5ffbcb;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-good {
    background: rgba(0, 180, 216, 0.15);
    color: #48cae4;
    border: 1px solid rgba(0, 180, 216, 0.25);
}

.status-average {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.status-poor {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.25);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
    position: relative;
    z-index: 2;
}

.stat-item {
    padding: 16px 12px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: var(--transition-fast);
    animation: fadeInUp 0.5s ease-out both;
}

.stat-item:nth-child(1) { animation-delay: 0.1s; }
.stat-item:nth-child(2) { animation-delay: 0.2s; }
.stat-item:nth-child(3) { animation-delay: 0.3s; }
.stat-item:nth-child(4) { animation-delay: 0.4s; }

.stat-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(0, 229, 160, 0.15);
    transform: translateY(-2px);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Reset Button */
.btn-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 229, 160, 0.2);
    background: rgba(0, 229, 160, 0.06);
    color: var(--primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    z-index: 2;
}

.btn-reset:hover {
    background: rgba(0, 229, 160, 0.12);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 229, 160, 0.1);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .container {
        padding: 20px 14px 40px;
    }

    .header h1 {
        font-size: 1.7rem;
    }

    .glass-card {
        padding: 20px 16px;
        border-radius: var(--radius-lg);
    }

    .subject-row {
        grid-template-columns: 1fr 70px 60px 32px;
        gap: 6px;
        padding: 10px;
    }

    .input-field {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .gpa-number {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .bg-orb {
        opacity: 0.3;
    }
}

/* ===== Scrollbar styling ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 160, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 160, 0.35);
}

/* ===== Subject Row Labels (mobile) ===== */
.subject-row .input-label {
    display: none;
}

@media (max-width: 420px) {
    .subject-row {
        grid-template-columns: 1fr 1fr 32px;
        gap: 6px;
    }
    
    .subject-row .input-name {
        grid-column: 1 / -2;
    }
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-state svg {
    margin-bottom: 10px;
    opacity: 0.4;
}
