/* Import Google Fonts for better typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #06b6d4;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-elevated: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 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);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #e2e8f0 100%);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    line-height: 1.6;
    color: var(--text-primary);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}



.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.menu-section {
    padding: 30px;
}

.menu-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 25px;
    text-align: center;
    position: relative;
}

.menu-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.menu-item {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.5s;
}

.menu-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.menu-item:hover::before {
    left: 100%;
}

.menu-item button {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    transition: color 0.3s ease;
}

.menu-item button:hover {
    color: var(--primary-color);
}

.menu-item .icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    vertical-align: middle;
    opacity: 0.7;
}

.menu-item p {
    margin: 12px 0 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-weight: 400;
}

.calculator-section {
    padding: 30px;
    background: var(--background);
    border-top: 1px solid var(--border);
}

.calculator {
    background: var(--surface);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.calculator-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 25px;
    text-align: center;
    position: relative;
}

.calculator-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--accent-color);
    border-radius: 2px;
}

.tool-description {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 25px;
    text-align: center;
    font-weight: 400;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

input, select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--surface);
    color: var(--text-primary);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #0891b2 100%);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-color) 0%, #d97706 100%);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.result-display {
    margin-top: 20px;
    padding: 20px;
    background: var(--surface-elevated);
    border-radius: 12px;
    border-left: 4px solid var(--success-color);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    animation: slideInResult 0.3s ease-out;
}

@keyframes slideInResult {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.error-message {
    border-left-color: var(--error-color);
    color: var(--error-color);
}

.hidden {
    display: none !important;
}

/* CGPA specific styles */
.cgpa-subjects {
    margin: 20px 0;
}

.subject-input {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px;
    background: var(--surface-elevated);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.subject-input input {
    flex: 1;
    margin: 0;
}

/* Physics specific styles */
.physics-category {
    margin-bottom: 20px;
}

.formula-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    transition: all 0.3s ease;
}

.formula-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.formula-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.formula-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 12px;
    }

    .header {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .menu-section, .calculator-section {
        padding: 20px;
    }

    .menu-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group .btn {
        width: 100%;
    }

    .central-logo {
        width: 200px;
        height: 200px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .calculator {
        padding: 20px;
    }

    .central-logo {
        width: 150px;
        height: 150px;
        opacity: 0.05;
    }
}

/* Loading animation */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

.physics-formula input {
    width: auto;
    margin-right: 10px;
}

/* About Us Section */
.about-section {
    padding: 30px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.about-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 25px;
    text-align: center;
    position: relative;
}

.about-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    border-radius: 2px;
}

.about-content {
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

.about-content p {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.about-content strong {
    color: var(--primary-color);
    font-weight: 600;
}

.about-content ul {
    margin: 15px 0;
    padding-left: 20px;
}

.about-content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* Copyright Section */
.copyright-section {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.copyright-section p {
    margin: 0;
    opacity: 0.9;
}