/* Scoped styles for the Calculator App */

:root {
    --calc-bg: rgba(17, 24, 39, 0.7);
    --calc-primary: #6366f1;
    --calc-primary-hover: #4f46e5;
    --calc-border: rgba(255, 255, 255, 0.1);
}

.app-container {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.calculator-wrapper {
    width: 100%;
    max-width: 420px;
    margin-top: 2rem;
}

.brand {
    margin-bottom: 1.5rem;
    text-align: center;
}

.brand h1 {
    font-size: 2rem;
    font-weight: 600;
    background: linear-gradient(to right, #818cf8, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.brand p {
    color: #94a3b8;
    font-size: 1rem;
}

/* Calculator Body */
.calc-body {
    background: var(--calc-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--calc-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
    overflow: hidden;
}

/* Display */
.calc-display {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--calc-border);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-end;
    overflow: hidden;
}

.expression {
    font-size: 0.9rem;
    color: #64748b;
    font-family: 'Courier New', Courier, monospace;
    min-height: 1.2em;
    word-break: break-all;
    text-align: right;
    width: 100%;
}

.result {
    font-size: 2.5rem;
    font-weight: 700;
    color: #f8fafc;
    font-family: 'Courier New', Courier, monospace;
    word-break: break-all;
    text-align: right;
    width: 100%;
    line-height: 1.2;
    min-height: 1.2em;
}

/* Button Grids */
.btn-grid {
    display: grid;
    gap: 0.5rem;
}

.scientific-row {
    grid-template-columns: repeat(5, 1fr);
    margin-bottom: 0.5rem;
}

.main-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* Buttons */
.calc-btn {
    border: none;
    border-radius: 12px;
    padding: 0.85rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Number buttons */
.num-btn {
    background: rgba(30, 41, 59, 0.8);
    color: #f8fafc;
    border: 1px solid var(--calc-border);
}

.num-btn:hover {
    background: rgba(51, 65, 85, 0.8);
}

/* Operator buttons */
.op-btn {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.25);
    font-size: 1.3rem;
}

.op-btn:hover {
    background: rgba(99, 102, 241, 0.25);
}

/* Equals button */
.eq-btn {
    background: linear-gradient(135deg, var(--calc-primary), var(--calc-primary-hover));
    color: white;
    font-size: 1.3rem;
}

.eq-btn:hover {
    filter: brightness(1.1);
}

/* Clear button */
.clear-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* Utility buttons */
.util-btn {
    background: rgba(51, 65, 85, 0.6);
    color: #94a3b8;
    border: 1px solid var(--calc-border);
}

.util-btn:hover {
    background: rgba(71, 85, 105, 0.6);
    color: #cbd5e1;
}

/* Function buttons (scientific) */
.fn-btn {
    background: rgba(30, 41, 59, 0.6);
    color: #94a3b8;
    border: 1px solid var(--calc-border);
    font-size: 0.8rem;
    padding: 0.6rem 0.4rem;
    font-family: 'Courier New', Courier, monospace;
}

.fn-btn:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.25);
}

/* History */
.history-section {
    margin-top: 1.5rem;
}

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

.history-header label {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.small-btn {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    transition: color 0.2s ease;
}

.small-btn:hover {
    color: #ef4444;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 200px;
    overflow-y: auto;
}

.empty-msg {
    color: #475569;
    font-size: 0.85rem;
    font-style: italic;
}

.history-item {
    background: rgba(17, 24, 39, 0.5);
    border: 1px solid var(--calc-border);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    border-color: var(--calc-primary);
    background: rgba(99, 102, 241, 0.05);
}

.history-expr {
    font-size: 0.8rem;
    color: #64748b;
    font-family: 'Courier New', Courier, monospace;
}

.history-result {
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
    font-family: 'Courier New', Courier, monospace;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 480px) {
    .calculator-wrapper {
        max-width: 100%;
    }

    .brand h1 {
        font-size: 1.6rem;
    }

    .calc-btn {
        padding: 0.7rem;
        font-size: 1rem;
    }

    .fn-btn {
        font-size: 0.7rem;
        padding: 0.5rem 0.3rem;
    }

    .result {
        font-size: 2rem;
    }
}
