/* ─── Variables (ACTotal Theme — Green Accent) ─── */
:root {
    --bg: #050506;
    --surface: #111827;
    --surface-light: #1f2937;
    --surface-hover: #374151;
    --accent: #10B981;
    --accent-light: #34d399;
    --accent-glow: rgba(16, 185, 129, 0.3);
    --text: #ffffff;
    --text-dim: #9ca3af;
    --radius: 20px;
    --radius-sm: 12px;
    --danger: #ef4444;
}

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

html,
body {
    height: 100%;
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* ─── Layout ─── */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    padding: 1.5rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ─── Header ─── */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, .08);
    background: var(--surface);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all .2s;
    font-size: 1.2rem;
}

.btn-icon:hover {
    background: var(--surface-light);
    color: var(--text);
}

/* ─── Main Content ─── */
.calc-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: fadeIn 0.4s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Mode Tabs ─── */
.mode-tabs {
    display: flex;
    gap: 0.4rem;
    background: var(--surface);
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.6rem 0.3rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mode-tab .tab-icon {
    font-size: 1.1rem;
    transition: transform 0.25s ease;
}

.mode-tab .tab-label {
    white-space: nowrap;
}

.mode-tab:hover {
    color: var(--text);
}

.mode-tab.active {
    background: var(--surface-light);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mode-tab.active .tab-icon {
    transform: scale(1.15);
}

/* ─── Calculator Card ─── */
.calc-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.calc-mode {
    display: none;
    animation: modeIn 0.3s ease-out;
}

.calc-mode.active {
    display: block;
}

@keyframes modeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mode-desc {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 1.2rem;
    line-height: 1.4;
}

/* ─── Input Row ─── */
.input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--bg);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
}

.input-wrapper input::-webkit-inner-spin-button,
.input-wrapper input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.15);
    font-weight: 500;
}

.input-wrapper input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-suffix {
    position: absolute;
    right: 0.85rem;
    color: var(--text-dim);
    font-weight: 700;
    font-size: 1rem;
    pointer-events: none;
}

.input-operator {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent);
    padding-bottom: 0.7rem;
    flex-shrink: 0;
}

/* ─── Quick Percent Buttons ─── */
.quick-btns {
    display: flex;
    gap: 0.4rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.quick-btn {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.4rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    color: var(--accent-light);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-btn:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: var(--accent);
}

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

/* ─── Result Card ─── */
.result-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(5, 150, 105, 0.04));
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    position: relative;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: border-color 0.3s;
}

.result-card.has-result {
    border-color: rgba(16, 185, 129, 0.35);
}

.result-expression {
    font-size: 0.95rem;
    color: var(--text-dim);
    font-weight: 500;
    line-height: 1.4;
    transition: opacity 0.2s;
}

.result-value {
    font-size: 2.6rem;
    font-weight: 900;
    color: var(--accent-light);
    letter-spacing: -0.03em;
    transition: all 0.25s ease;
    line-height: 1.1;
}

.result-value.error {
    font-size: 1rem;
    color: var(--danger);
    font-weight: 600;
}

.result-value.pop {
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% {
        transform: scale(0.9);
        opacity: 0.5;
    }

    60% {
        transform: scale(1.04);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ─── Copy Button ─── */
.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.3rem;
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.btn-copy.copied {
    color: var(--accent-light);
    border-color: var(--accent);
}

/* ─── Info Text ─── */
.info-text {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
    line-height: 1.5;
}

/* ─── Footer ─── */
.app-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: auto;
    padding-top: 2rem;
    line-height: 1.5;
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}