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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #06b6d4;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 40px 0 30px;
    position: relative;
}

header h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 10px;
}

.language-selector {
    position: absolute;
    top: 20px;
    right: 20px;
}

.language-selector select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.9);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.language-selector select:hover {
    background: white;
    border-color: rgba(255,255,255,0.5);
}

main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.calc-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

.tab-container {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.input-group {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    justify-content: center;
}

.input-field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-field label {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.input-field input {
    width: 120px;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 18px;
    text-align: center;
    transition: all 0.3s ease;
}

.input-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.calc-btn {
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

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

.calc-btn.clicked {
    transform: scale(0.95);
}

.calc-btn .formula {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.calc-btn .btn-label {
    font-size: 14px;
    opacity: 0.9;
}

.result-section {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border-radius: 10px;
    padding: 25px;
}

.result-header {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.result-display {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.formula-display {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.result-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    text-align: right;
    word-break: break-all;
}

.calculation-steps {
    margin-top: 20px;
}

.steps-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.steps-content {
    padding: 15px;
    background: white;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: var(--text-primary);
}

.info-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

.info-section h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 25px;
    text-align: center;
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.info-card {
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.info-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.info-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.info-card .example {
    font-size: 13px;
    color: var(--text-primary);
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 10px;
}

footer {
    text-align: center;
    padding: 30px 0;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .language-selector {
        position: static;
        margin-top: 15px;
    }
    
    .input-group {
        flex-direction: column;
        align-items: center;
    }
    
    .calc-buttons {
        grid-template-columns: 1fr;
    }
    
    .result-display {
        flex-direction: column;
        text-align: center;
    }
    
    .result-value {
        text-align: center;
    }
    
    .info-cards {
        grid-template-columns: 1fr;
    }
}