/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #334155;
    background-color: #f8fafc;
}

/* Container */
.calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
.calculator-header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
    color: white;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.2);
}

.header-content {
    text-align: center;
}

.calculator-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.calculator-icon {
    font-size: 2rem;
    color: #93c5fd;
}

.calculator-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.calculator-description {
    font-size: 1.125rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Interface */
.calculator-main {
    display: grid;
    gap: 24px;
}

.calculator-interface {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

/* Panels */
.input-panel,
.output-panel {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.input-panel h2,
.output-panel h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-panel h2::before {
    content: "📝";
}

.output-panel h2::before {
    content: "📊";
}

/* Input Fields */
.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #374151;
    font-size: 0.875rem;
}

.input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-field {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #fafafa;
}

.input-field:focus {
    outline: none;
    border-color: #2563eb;
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-field.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.unit-selector {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 0.875rem;
    min-width: 80px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unit-selector:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 4px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Control Buttons */
.control-buttons {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #475569;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Result Fields */
.result-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.result-placeholder i {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid #10b981;
}

.result-label {
    font-weight: 500;
    color: #374151;
}

.result-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #059669;
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    color: #374151;
    background: #e5e7eb;
}

/* Educational Content */
.educational-content {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.content-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    flex: 1;
    padding: 16px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: #e2e8f0;
    color: #475569;
}

.tab-btn.active {
    background: white;
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
}

.tab-content {
    padding: 24px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-panel h3 {
    margin-bottom: 16px;
    color: #1e293b;
    font-size: 1.25rem;
}

/* Calculator Selector */
.calculator-selector {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    margin-top: 24px;
}

.calculator-selector h3 {
    margin-bottom: 16px;
    color: #1e293b;
    font-size: 1.125rem;
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.calculator-card {
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #64748b;
}

.calculator-card:hover {
    border-color: #2563eb;
    background: #f0f9ff;
    color: #2563eb;
    transform: translateY(-2px);
}

.calculator-card.active {
    border-color: #2563eb;
    background: #2563eb;
    color: white;
}

.calculator-card i {
    font-size: 1.5rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    background: white;
    padding: 32px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.loading-spinner i {
    font-size: 2rem;
    color: #2563eb;
    margin-bottom: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-container {
        padding: 12px;
    }

    .calculator-header {
        padding: 24px 20px;
    }

    .calculator-header h1 {
        font-size: 2rem;
    }

    .calculator-interface {
        grid-template-columns: 1fr;
    }

    .control-buttons {
        flex-direction: column;
    }

    .content-tabs {
        flex-direction: column;
    }

    .tab-btn {
        justify-content: flex-start;
        padding: 12px 20px;
    }

    .calculator-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .calculator-header h1 {
        font-size: 1.75rem;
    }

    .calculator-description {
        font-size: 1rem;
    }

    .input-panel,
    .output-panel {
        padding: 16px;
    }

    .calculator-grid {
        grid-template-columns: 1fr;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

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

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.hidden {
    display: none;
}

