:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #64748b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 30px rgba(99, 102, 241, 0.15);
    --shadow-xl: 0 20px 50px rgba(99, 102, 241, 0.2);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px 0;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(14, 165, 233, 0.3) 0%, transparent 50%);
    animation: moveBackground 15s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes moveBackground {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    50% {
        transform: translate(30px, 30px) scale(1.05);
    }
}

.container {
    position: relative;
    z-index: 1;
}

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

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-section h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: white;
    margin-bottom: 15px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.02em;
}

.header-section p {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Main Calculator Card */
.calculator-card {
    background: white;
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 30px;
    border: none;
}

.card-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header p {
    margin: 0;
    opacity: 0.95;
    font-size: 0.95rem;
}

.card-body {
    padding: 35px;
}

/* Settings Section */
.settings-section {
    background: var(--light);
    padding: 25px;
    border-radius: 16px;
    margin-bottom: 30px;
    border: 2px solid #e2e8f0;
}

.settings-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-select,
.form-control {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
}

.form-select:focus,
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    outline: none;
}

/* Semester Cards */
.semester-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease-out backwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.semester-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.semester-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.semester-header h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.remove-semester {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.remove-semester:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Subject Row */
.subject-row {
    display: grid;
    grid-template-columns: 1fr 120px 100px 50px;
    gap: 12px;
    align-items: end;
    margin-bottom: 12px;
}

@media (max-width: 768px) {
    .subject-row {
        grid-template-columns: 1fr;
    }
}

.remove-subject {
    background: transparent;
    border: 2px solid var(--danger);
    color: var(--danger);
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
}

.remove-subject:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

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

.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-outline-custom {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline-custom:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.btn-success-custom {
    background: var(--success);
    color: white;
}

.btn-success-custom:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* Result Section */
.result-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 35px;
    border-radius: 16px;
    margin-top: 30px;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.5s ease-out;
    display: none;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-section.show {
    display: block;
}

.result-value {
    font-size: 4rem;
    font-weight: 800;
    font-family: 'Space Mono', monospace;
    text-align: center;
    margin: 20px 0;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: countUp 0.8s ease-out;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.result-item {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.result-item-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
}

.result-item-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}

/* Info Section */
.info-section {
    background: var(--light);
    padding: 30px;
    border-radius: 16px;
    margin-top: 40px;
    animation: fadeInUp 0.8s ease-out 0.4s backwards;
}

.info-section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-section h3 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 25px;
    margin-bottom: 15px;
}

.info-section p,
.info-section li {
    color: var(--gray);
    line-height: 1.7;
    font-size: 1rem;
}

.info-section ul {
    padding-left: 25px;
}

.info-section li {
    margin-bottom: 10px;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: white;
    animation: fadeIn 1s ease-out 0.6s backwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.footer a {
    color: white;
    text-decoration: underline;
    transition: opacity 0.3s;
}

.footer a:hover {
    opacity: 0.8;
}

/* Google Ad Sidebar */
.ad-sidebar {
    position: sticky;
    top: 20px;
    animation: fadeInUp 0.8s ease-out 0.3s backwards;
}

.ad-container {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid #e2e8f0;
}

.ad-label {
    font-size: 0.75rem;
    color: var(--gray);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.ad-placeholder {
    width: 100%;
    min-height: 250px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1199px) {
    .ad-sidebar {
        position: relative;
        top: 0;
        margin-top: 30px;
    }

    .ad-container {
        min-height: 300px;
    }
}

/* Badge */
.grade-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: 10px;
}

.grade-excellent {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.grade-good {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.grade-average {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.grade-poor {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}