/* ===============================================
   GRADE CALCULATOR - USING MODERNTOOLS UNIFIED THEME
   =============================================== */

/* Use modern tools color scheme */
:root {
    --primary-color: #3B82F6;
    --secondary-color: #10B981;
    --accent-color: #8B5CF6;
    --text-color: #111827;
    --text-secondary: #4B5563;
    --text-tertiary: #6B7280;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --border-color: #E5E7EB;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-base: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;    
    --radius-2xl: 1.5rem;
    
    /* Gray color scale for consistency */
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    
    /* Additional colors for grade calculator functionality */
    --danger-color: #EF4444;
    --danger-light: #FCA5A5;
    
    /* Grade-specific colors */
    --grade-a: #00b894;
    --grade-b: #00cec8;
    --grade-c: #fdcb6e;
    --grade-d: #e17055;
    --grade-f: #e74c3c;
    
    /* Status colors */
    --success-color: #00b894;
    --warning-color: #fdcb6e;
    --info-color: #00cec8;
    
    /* Aliases for compatibility with existing code */
    --brand-primary: var(--primary-color);
    --brand-secondary: var(--secondary-color);
    --text-primary: var(--text-color);
}

/* Dark theme using exact same colors as percentage calculator */
[data-theme="dark"] {
    --text-color: #F9FAFB;
    --text-secondary: #D1D5DB;
    --text-tertiary: #9CA3AF;
    --bg-primary: #111827;
    --bg-secondary: #1F2937;
    --bg-tertiary: #374151;
    --border-color: #374151;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    
    /* Gray color scale for dark theme */
    --gray-100: #374151;
    --gray-200: #4B5563;
    --gray-300: #6B7280;
    --gray-400: #9CA3AF;
    
    /* Aliases for compatibility with existing code */
    --brand-primary: var(--primary-color);
    --brand-secondary: var(--secondary-color);
    --text-primary: var(--text-color);
}

/* Theme-aware background support for the entire calculator */
body {
    background: var(--bg-primary);
}

/* Dark theme override for body */
[data-theme="dark"] body {
    background: var(--bg-primary);
}

/* ===============================================
   HERO SECTION STYLES
   =============================================== */

.tool-hero {
    margin-top: 0;
    padding: 120px 0 80px;
    position: relative;
    z-index: 2;
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(59, 130, 246, 0.1) 30%, rgba(16, 185, 129, 0.1) 70%, var(--bg-primary) 100%);
    overflow: hidden;
}

.hero-content {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 3;
}

.hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    margin: 0 auto 30px auto;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 50%, var(--accent-color) 100%);
    border-radius: 50%;
    box-shadow: 
        0 15px 35px rgba(59, 130, 246, 0.4),
        0 0 0 10px rgba(59, 130, 246, 0.1),
        0 0 0 20px rgba(59, 130, 246, 0.05);
    animation: heroIconFloat 4s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

@keyframes heroIconFloat {
    0%, 100% { transform: translateY(0px) scale(1) rotate(0deg); }
    25% { transform: translateY(-5px) scale(1.02) rotate(-3deg); }
    75% { transform: translateY(-2px) scale(1.01) rotate(3deg); }
}

.hero-icon::before {
    content: '';
    position: absolute;
    inset: -5px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    border-radius: 50%;
    z-index: -1;
    opacity: 0.4;
    animation: heroIconGlow 3s ease-in-out infinite;
}

@keyframes heroIconGlow {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

.hero-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: conic-gradient(
        from 0deg, 
        var(--primary-color) 0%, 
        var(--secondary-color) 25%, 
        var(--accent-color) 50%, 
        var(--primary-color) 75%, 
        var(--secondary-color) 100%
    );
    border-radius: 50%;
    z-index: -2;
    opacity: 0.2;
    animation: heroGradeRotate 8s linear infinite;
}

@keyframes heroGradeRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.hero-icon i {
    font-size: 3rem;
    color: white;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    animation: heroIconBounce 5s ease-in-out infinite;
    z-index: 2;
}

@keyframes heroIconBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-10deg); }
    75% { transform: scale(1.05) rotate(10deg); }
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: heroTitleShine 6s ease-in-out infinite;
}

@keyframes heroTitleShine {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; }
}

.hero-content p {
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 0;
    font-weight: 400;
}

.tool-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;    background: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    animation: heroBackgroundPulse 8s ease-in-out infinite;
}

@keyframes heroBackgroundPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 3;
}

.hero-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    margin: 0 auto 30px auto;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 50%, var(--accent-color) 100%);
    border-radius: 50%;    box-shadow: 
        0 15px 35px rgba(59, 130, 246, 0.4),
        0 0 0 10px rgba(59, 130, 246, 0.1),
        0 0 0 20px rgba(59, 130, 246, 0.05);
    animation: heroIconFloat 4s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

@keyframes heroIconFloat {
    0%, 100% { transform: translateY(0px) scale(1) rotate(0deg); }
    25% { transform: translateY(-5px) scale(1.02) rotate(-3deg); }
    75% { transform: translateY(-2px) scale(1.01) rotate(3deg); }
}

.hero-icon::before {
    content: '';
    position: absolute;
    inset: -5px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    border-radius: 50%;
    z-index: -1;
    opacity: 0.4;
    animation: heroIconGlow 3s ease-in-out infinite;
}

@keyframes heroIconGlow {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

.hero-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: conic-gradient(
        from 0deg, 
        var(--primary-color) 0%, 
        var(--secondary-color) 25%, 
        var(--accent-color) 50%, 
        var(--primary-color) 75%, 
        var(--secondary-color) 100%
    );
    border-radius: 50%;
    z-index: -2;
    opacity: 0.2;
    animation: heroGradeRotate 8s linear infinite;
}

@keyframes heroGradeRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.hero-icon i {
    font-size: 3rem;
    color: white;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    animation: heroIconBounce 5s ease-in-out infinite;
    z-index: 2;
}

@keyframes heroIconBounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-10deg); }
    75% { transform: scale(1.05) rotate(10deg); }
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: heroTextGlow 6s ease-in-out infinite;
}

@keyframes heroTextGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 600px;
    margin: 0 auto;
}

/* ===============================================
   CALCULATOR MAIN STYLES - MATCHING PERCENTAGE CALCULATOR
   =============================================== */

.calculator-main {
    padding: 80px 0;
    background: var(--bg-secondary);
}

.calculator-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* ===============================================
   CALCULATOR TABS STYLES
   =============================================== */

.calculator-tabs {
    display: flex;
    flex-wrap: wrap;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.tab-button {
    flex: 1;
    min-width: 120px;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border-right: 1px solid var(--border-color);
}

.tab-button:last-child {
    border-right: none;
}

.tab-button:hover {
    background: rgba(59, 130, 246, 0.05);
    color: var(--text-color);
}

.tab-button.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    font-weight: 600;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

/* ===============================================
   CALCULATOR CARD STYLES - ENHANCED VISUALS
   =============================================== */

.calculator-card {
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.calculator-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.calculator-display {
    padding: 2.5rem 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    position: relative;
    overflow: hidden;
}

.calculator-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at center, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    animation: displayGlow 4s ease-in-out infinite;
}

@keyframes displayGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.display-result {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 2;
}

.result-value {
    font-size: 4rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    animation: valueShimmer 3s ease-in-out infinite;
    position: relative;
}

.result-value::before {
    content: attr(data-value);
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.3;
    filter: blur(2px);
    z-index: -1;
}

@keyframes valueShimmer {
    0%, 100% { 
        filter: brightness(1) drop-shadow(0 0 10px rgba(59, 130, 246, 0.3)); 
        transform: scale(1);
    }
    50% { 
        filter: brightness(1.3) drop-shadow(0 0 20px rgba(59, 130, 246, 0.5)); 
        transform: scale(1.02);
    }
}

.result-unit {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    opacity: 0.8;
}

.display-formula {
    font-size: 1.1rem;
    color: var(--text-tertiary);
    font-weight: 500;
    position: relative;
    z-index: 2;
}

/* ===============================================
   INPUT SECTIONS STYLES
   =============================================== */

.calculator-inputs {
    position: relative;
}

.input-section {
    display: none;
    padding: 2rem;
}

.input-section.active {
    display: block;
}

/* Field-level validation styles */
.form-input.invalid,
.form-select.invalid {
    border-color: var(--danger-color);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.03), rgba(239, 68, 68, 0.05));
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.invalid:focus,
.form-select.invalid:focus {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Section-level validation styles */
.input-section.invalid {
    border: 2px solid var(--danger-color);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.03), rgba(239, 68, 68, 0.05));
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    animation: shakeSection 0.5s ease-in-out;
}

@keyframes shakeSection {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Validation message styles */
.validation-message {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--danger-color);
    font-weight: 500;
    line-height: 1.4;
}

.validation-message.show {
    animation: slideInMessage 0.3s ease-out;
}

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculation-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.calculation-controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.assignments-container,
.courses-container {
    margin-bottom: 1.5rem;
}

.assignment-item,
.course-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.assignment-item::before,
.course-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.assignment-item:hover::before,
.course-item:hover::before {
    opacity: 1;
}

.assignment-item:hover,
.course-item:hover {
    border-color: var(--primary-color);
    box-shadow: 
        0 8px 16px rgba(59, 130, 246, 0.1),
        0 4px 8px rgba(59, 130, 246, 0.05);
    transform: translateY(-2px);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1rem;
}

/* ===============================================
   CALCULATOR ACTIONS STYLES
   =============================================== */

.calculator-actions {
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.btn-calculate {
    width: 100%;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 8px 16px rgba(59, 130, 246, 0.2),
        0 4px 8px rgba(59, 130, 246, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-calculate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.btn-calculate:hover::before {
    left: 100%;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 24px rgba(59, 130, 246, 0.3),
        0 6px 12px rgba(59, 130, 246, 0.2);
}

.btn-calculate:active {
    transform: translateY(0);
    box-shadow: 
        0 4px 8px rgba(59, 130, 246, 0.2),
        0 2px 4px rgba(59, 130, 246, 0.1);
}

/* ===============================================
   RESULTS SECTION STYLES
   =============================================== */

.results-section {
    margin-top: 2rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0;
}

.result-card {
    padding: 2rem;
    text-align: center;
    border-right: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    transition: all 0.3s ease;
    position: relative;
}

.result-card:last-child {
    border-right: none;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.result-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-card .result-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.result-subtitle {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

/* ===============================================
   FORM ELEMENTS
   =============================================== */

.form-input, .form-select {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-primary);
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
}

.form-input:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.1),
        0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.form-input:hover, .form-select:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

/* ===============================================
   BUTTONS
   =============================================== */

.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.95rem;
    min-height: 48px;
    justify-content: center;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 
        0 4px 8px rgba(59, 130, 246, 0.2),
        0 2px 4px rgba(59, 130, 246, 0.1);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 16px rgba(59, 130, 246, 0.3),
        0 4px 8px rgba(59, 130, 246, 0.2);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.1);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    box-shadow: 
        0 4px 8px rgba(239, 68, 68, 0.2),
        0 2px 4px rgba(239, 68, 68, 0.1);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 16px rgba(239, 68, 68, 0.3),
        0 4px 8px rgba(239, 68, 68, 0.2);
}

/* ===============================================
   ASSIGNMENTS SECTION
   =============================================== */

.assignments-container {
    margin-bottom: 1.5rem;
}

.assignment-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.assignment-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 206, 200, 0.1);
}

.assignment-item .btn-danger {
    padding: 0.5rem;
    min-height: auto;
}

/* ===============================================
   CALCULATION CONTROLS
   =============================================== */

.calculation-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-base);
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

/* ===============================================
   RESULTS SECTION
   =============================================== */

.results-section, .gpa-results, .exam-results, .cumulative-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.result-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.result-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 206, 200, 0.1);
}

.result-letter, .result-points, .result-scale, .result-change {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.result-status {
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-base);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-status.achievable {
    background: rgba(0, 184, 148, 0.1);
    color: var(--success-color);
}

.result-status.challenging {
    background: rgba(253, 203, 110, 0.1);
    color: var(--warning-color);
}

.result-status.impossible {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

/* Grade-specific result card colors */
.result-card.grade-a .result-value { color: var(--grade-a); }
.result-card.grade-b .result-value { color: var(--grade-b); }
.result-card.grade-c .result-value { color: var(--grade-c); }
.result-card.grade-d .result-value { color: var(--grade-d); }
.result-card.grade-f .result-value { color: var(--grade-f); }

/* ===============================================
   COURSES SECTION (GPA)
   =============================================== */

.courses-container {
    margin-bottom: 1.5rem;
}

.course-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 1rem;
    align-items: end;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-base);
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.course-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 206, 200, 0.1);
}

/* ===============================================
   RESPONSIVE DESIGN
   =============================================== */

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .hero-content p {
        font-size: 1.1rem;
    }
    
    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .assignment-item, .course-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .assignment-item .btn-danger {
        justify-self: start;
        width: fit-content;
    }
    
    .panel-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .panel-controls {
        justify-content: stretch;
    }
    
    .panel-controls .btn-primary,
    .panel-controls .btn-secondary {
        flex: 1;
    }
    
    .calculation-controls {
        grid-template-columns: 1fr;
    }
      .results-section, .gpa-results, .exam-results, .cumulative-results {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .tool-hero {
        padding: 100px 0 60px;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-icon {
        width: 80px;
        height: 80px;
    }
    
    .hero-icon i {
        font-size: 2.5rem;
    }
    
    .calculator-panel {
        padding: 1.5rem;
    }
    
    .calculator-main {
        padding: 60px 0;
    }
}

/* ===============================================
   RESPONSIVE DESIGN - MATCHING PERCENTAGE CALCULATOR
   =============================================== */

@media (max-width: 768px) {
    .calculator-container {
        margin: 0 1rem;
        border-radius: var(--radius-xl);
    }
    
    .calculator-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        min-width: auto;
        padding: 0.75rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .tab-button:last-child {
        border-bottom: none;
    }
    
    .tab-button.active::after {
        height: 3px;
        left: 0;
        right: auto;
        width: 3px;
        bottom: 0;
        top: 0;
    }
    
    .calculator-display,
    .calculator-inputs,
    .calculator-actions {
        padding: 1.5rem;
    }
    
    .result-value {
        font-size: 2.5rem;
    }
    
    .assignment-item,
    .course-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .assignment-item .btn-danger,
    .course-item .btn-danger {
        justify-self: start;
        width: fit-content;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .results-container {
        grid-template-columns: 1fr;
    }
    
    .result-card {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .result-card:last-child {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    .calculator-main {
        padding: 60px 0;
    }
    
    .calculator-mode-toggle {
        padding: 1.5rem 1rem 1rem;
    }
    
    .toggle-container {
        gap: 0.75rem;
    }
    
    .toggle-label {
        font-size: 0.8rem;
    }
    
    .mode-toggle {
        width: 50px;
        height: 25px;
    }
    
    .toggle-slider {
        width: 19px;
        height: 19px;
    }
    
    .mode-toggle.advanced .toggle-slider {
        transform: translateX(25px);
    }
    
    .calculator-display,
    .calculator-inputs,
    .calculator-actions {
        padding: 1rem;
    }
    
    .result-value {
        font-size: 2rem;
    }
    
    .result-unit {
        font-size: 1.2rem;
    }
    
    .btn-calculate {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* ===============================================
   GRADE CALCULATOR MOBILE RESPONSIVE STYLES
   =============================================== */

/* Tablet Styles */
@media (max-width: 1024px) {
    .hero-content h1 {
        font-size: 2.8rem;
    }
    
    .calculator-container {
        margin: 0 1rem;
    }
    
    .calculator-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-button {
        min-width: 140px;
        white-space: nowrap;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .tool-hero {
        padding: 100px 0 60px;
    }
    
    .hero-content h1 {
        font-size: 2.2rem;
    }
    
    .hero-content p {
        font-size: 1.1rem;
    }
    
    .hero-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
    }
    
    .hero-icon i {
        font-size: 2.2rem;
    }
    
    .calculator-container {
        margin: 0 0.5rem;
        border-radius: var(--radius-lg);
    }
    
    .calculator-tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tab-button {
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
    }
    
    .calculator-display {
        padding: 2rem 1.5rem;
    }
    
    .result-value {
        font-size: 3rem;
    }
    
    .result-unit {
        font-size: 1.4rem;
    }
    
    .input-section {
        padding: 1.5rem;
    }
    
    .calculation-controls {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
    
    .assignment-item,
    .course-item {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        padding: 1rem;
    }
    
    .assignment-item .input-group,
    .course-item .input-group {
        margin-bottom: 0.5rem;
    }
    
    .action-buttons {
        gap: 0.5rem;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    .calculator-actions {
        padding: 1.5rem;
    }
    
    .btn-calculate {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
}

/* Small Mobile Styles */
@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .hero-content p {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    .calculator-tabs {
        grid-template-columns: 1fr;
    }
    
    .tab-button {
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .tab-button:last-child {
        border-bottom: none;
    }
    
    .result-value {
        font-size: 2.5rem;
    }
    
    .display-formula {
        font-size: 1rem;
    }
    
    .assignment-item,
    .course-item {
        padding: 0.8rem;
    }
    
    .form-input,
    .form-select {
        padding: 0.8rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-danger:hover,
    .btn-calculate:hover {
        transform: none;
    }
    
    .assignment-item:hover,
    .course-item:hover {
        transform: none;
    }
    
    /* Larger touch targets */
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        min-height: 48px;
    }
    
    .form-input,
    .form-select {
        min-height: 48px;
    }
}

/* ===============================================
   MOBILE OPTIMIZATION - DISABLE ANIMATIONS & OPTIMIZE PERFORMANCE
   =============================================== */

/* Disable all animations on mobile devices for better performance */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    /* Disable all animations and transitions for mobile performance */
    *, *::before, *::after {
        animation-duration: 0s !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0s !important;
        transition-delay: 0s !important;
        transform: none !important;
    }
    
    /* Remove hover effects on mobile */
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-danger:hover,
    .btn-calculate:hover {
        transform: none !important;
        box-shadow: 
            0 4px 8px rgba(59, 130, 246, 0.2),
            0 2px 4px rgba(59, 130, 246, 0.1);
    }
    
    .assignment-item:hover,
    .course-item:hover,
    .result-card:hover {
        transform: none !important;
        border-color: var(--border-color);
        box-shadow: none;
    }
    
    /* Remove glow and shimmer effects */
    .result-value::before {
        display: none;
    }
    
    /* Simplify hero section for mobile */
    .hero-icon {
        background: var(--primary-color);
        box-shadow: none;
    }
    
    .hero-icon::before,
    .hero-icon::after {
        display: none;
    }
    
    .calculator-display::before {
        display: none;
    }
    
    /* Remove gradients on low-end devices for better performance */
    .btn-primary {
        background: var(--primary-color);
    }
    
    .hero-content h1 {
        background: none;
        -webkit-background-clip: initial;
        -webkit-text-fill-color: initial;
        background-clip: initial;
        color: var(--primary-color);
    }
    
    .result-value {
        background: none;
        -webkit-background-clip: initial;
        -webkit-text-fill-color: initial;
        background-clip: initial;
        color: var(--primary-color);
        text-shadow: none;
    }
}

/* Remove shake animation completely */
@media (max-width: 768px) {
    .input-section.invalid {
        animation: none;
    }
    
    .validation-message.show {
        animation: none;
    }
}

/* Ultra-light mode for very low-end devices */
@media (max-width: 480px) and (max-resolution: 1.5dppx) {
    /* Remove all box shadows */
    * {
        box-shadow: none !important;
    }
    
    /* Simplify borders */
    .calculator-container,
    .result-card,
    .assignment-item,
    .course-item {
        border: 1px solid var(--border-color);
        border-radius: var(--radius-base);
    }
    
    /* Remove gradients completely */
    .calculation-controls,
    .result-card,
    .assignment-item,
    .course-item {
        background: var(--bg-secondary);
    }
    
    .calculator-display {
        background: var(--bg-primary);
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    /* Remove all keyframe animations */
    .hero-icon,
    .hero-icon::before,
    .hero-icon::after,
    .hero-icon i,
    .hero-content h1,
    .calculator-display::before,
    .result-value,
    .input-section.invalid,
    .validation-message.show {
        animation: none !important;
    }
}

/* ===============================================
   TOUCH-FRIENDLY OPTIMIZATIONS
   =============================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .tab-button {
        min-height: 48px;
        padding: 0.75rem 1.5rem;
    }
    
    .form-input,
    .form-select {
        min-height: 48px;
        padding: 0.75rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Remove hover states that don't work on touch */
    .help-icon:hover::before,
    .help-icon:hover::after {
        opacity: 0;
        visibility: hidden;
    }
    
    /* Tap feedback for better UX */
    .btn-primary:active,
    .btn-secondary:active,
    .btn-danger:active {
        opacity: 0.8;
    }
}

/* ===============================================
   BANDWIDTH OPTIMIZATION
   =============================================== */

/* Hide decorative elements on slow connections */
@media (max-width: 768px) and (max-bandwidth: 1mbps) {
    .hero-icon::before,
    .hero-icon::after,
    .calculation-controls::before,
    .assignment-item::before,
    .course-item::before,
    .result-card::before {
        display: none;
    }
    
    /* Use solid colors instead of gradients */
    .hero-icon,
    .btn-primary,
    .btn-calculate {
        background: var(--primary-color);
    }
    
    .calculation-controls {
        background: var(--bg-secondary);
    }
}

/* ===============================================
   ACCESSIBILITY IMPROVEMENTS
   =============================================== */

/* High contrast mode */
@media (prefers-contrast: high) {
    .form-input.invalid,
    .form-select.invalid {
        border-color: #ff0000;
        border-width: 3px;
    }
    
    .input-section.invalid {
        border-color: #ff0000;
        border-width: 3px;
    }
    
    .validation-message {
        color: #ff0000;
        font-weight: 700;
    }
}

/* Focus improvements for keyboard navigation */
.tab-button:focus,
.btn-primary:focus,
.btn-secondary:focus,
.btn-danger:focus,
.form-input:focus,
.form-select:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    z-index: 10;
    position: relative;
}

/* ===============================================
   GPA GUIDE IMAGES - RESPONSIVE AND ACCESSIBLE
   =============================================== */

.gpa-guide-image,
.honors-guide-image {
    margin: 1rem 0;
    text-align: center;
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    padding: 0.75rem;
    border: 1px solid var(--border-color);
}

.gpa-guide-image img,
.honors-guide-image img {
    width: 100%;
    max-width: 380px;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-base);
}

.guide-instructions,
.quick-tips {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-base);
    border-left: 4px solid var(--primary-color);
}

.guide-instructions h5,
.quick-tips p {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: var(--text-color);
}

.guide-instructions ol,
.quick-tips ul {
    margin: 0;
    padding-left: 1.5rem;
}

.guide-instructions li,
.quick-tips li {
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Mobile optimizations for guide images */
@media (max-width: 768px) {
    .gpa-guide-image,
    .honors-guide-image {
        margin: 0.75rem 0;
        padding: 0.5rem;
    }
    
    .guide-instructions,
    .quick-tips {
        padding: 0.75rem;
        margin-top: 0.75rem;
    }
}

@media (max-width: 480px) {
    .guide-instructions ol,
    .quick-tips ul {
        padding-left: 1.2rem;
    }
}

/* Dark theme support for guide sections */
[data-theme="dark"] .gpa-guide-image,
[data-theme="dark"] .honors-guide-image {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

[data-theme="dark"] .guide-instructions,
[data-theme="dark"] .quick-tips {
    background: var(--bg-secondary);
}

/* Print styles */
@media print {
    .gpa-guide-image,
    .honors-guide-image {
        break-inside: avoid;
    }
}
