/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
                 'Helvetica Neue', Arial, sans-serif;
    background: #f0f4f8;
    color: #1a202c;
    -webkit-font-smoothing: antialiased;
}

/* ─── Page Wrapper ──────────────────────────────────────────── */
.calc-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
}

/* ─── Card ──────────────────────────────────────────────────── */
.calc-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem 1.75rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 
                0 1px 4px rgba(0, 0, 0, 0.04);
}

/* ─── Header ────────────────────────────────────────────────── */
.calc-header {
    text-align: center;
    margin-bottom: 2rem;
}

.calc-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    line-height: 1;
    color: #667eea;
}

.calc-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.5px;
}

.calc-subtitle {
    font-size: 0.8rem;
    color: #a0aec0;
    margin-top: 0.25rem;
}

/* ─── Inputs ────────────────────────────────────────────────── */
.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #718096;
    margin-bottom: 0.4rem;
}

.input-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1.25rem;
    font-weight: 500;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #f7fafc;
    color: #1a202c;
    -webkit-appearance: none;
    appearance: none;
}

.input-group input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: #fff;
}

.input-group input::placeholder {
    color: #cbd5e0;
    font-weight: 400;
}

/* ─── Operator Row ──────────────────────────────────────────── */
.operator-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.op-btn {
    flex: 1;
    padding: 0.65rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #f7fafc;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.op-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #eef2ff;
}

.op-btn:active {
    transform: scale(0.95);
}

.op-active {
    background: #667eea !important;
    border-color: #667eea !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

/* ─── Calculate Button ──────────────────────────────────────── */
.calc-btn {
    width: 100%;
    padding: 0.95rem;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: opacity 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.calc-btn:hover {
    opacity: 0.92;
}

.calc-btn:active {
    transform: scale(0.98);
    opacity: 0.88;
}

/* ─── Result Box ────────────────────────────────────────────── */
.result-box {
    margin-top: 1.25rem;
    padding: 1.25rem;
    border-radius: 14px;
    text-align: center;
    animation: fadeIn 0.2s ease;
}

.result-ok {
    background: linear-gradient(135deg, #e0f2fe 0%, #e8f5e9 100%);
    border: 1.5px solid #b2dfdb;
}

.result-error {
    background: #fff5f5;
    border: 1.5px solid #fed7d7;
}

.result-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #718096;
    margin-bottom: 0.3rem;
}

.result-equation {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 0.25rem;
}

.result-ok .result-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #2d3748;
    letter-spacing: -1px;
    line-height: 1.1;
}

.result-error .result-value {
    font-size: 1rem;
    font-weight: 600;
    color: #c53030;
}

/* ─── History ───────────────────────────────────────────────── */
.history-section {
    margin-top: 1.5rem;
    border-top: 1px solid #f0f0f0;
    padding-top: 1rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.history-header span {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a0aec0;
}

.clear-btn {
    font-size: 0.72rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: transparent;
    color: #a0aec0;
    cursor: pointer;
    transition: all 0.15s;
}

.clear-btn:hover {
    color: #e53e3e;
    border-color: #fed7d7;
    background: #fff5f5;
}

.history-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-list li {
    font-size: 0.82rem;
    padding: 0.4rem 0.6rem;
    background: #f7fafc;
    border-radius: 7px;
    color: #4a5568;
    font-variant-numeric: tabular-nums;
}

/* ─── PWA Footer ────────────────────────────────────────────── */
.pwa-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
    font-size: 0.72rem;
    color: #cbd5e0;
}

.pwa-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #48bb78;
    display: inline-block;
    animation: pulse 2s infinite;
}

/* ─── Animations ────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ─── Loading Screen ────────────────────────────────────────── */
#app .loading-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 9999;
}

#app .loading-progress-text {
    display: none;
}

/* Blazor default spinner override */
.loading-progress {
    background: #667eea;
}
