/* ============================================================
   CALCULADORA 4×1000 — VERSIÓN SIMPLIFICADA
   Design: Neo-Bancario Minimalista
   Colors: Verde esmeralda (#0D5C3A) + Dorado (#C9A84C)
   Fonts: Sora (UI) + IBM Plex Mono (números)
   ============================================================ */

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

:root {
    /* Paleta Neo-Bancaria */
    --emerald-900: #0D5C3A;
    --emerald-800: #1B7A52;
    --emerald-700: #2B9B6D;
    --emerald-600: #3BB885;
    --emerald-500: #4DD99D;
    --emerald-100: #E8F5F0;
    --emerald-50: #F7FBFA;
    
    --gold-500: #C9A84C;
    --gold-400: #D4B866;
    --gold-300: #E0C680;
    
    --white: #FFFFFF;
    --gray-50: #FAFAF7;
    --gray-100: #F5F5F2;
    --gray-200: #E8E8E5;
    --gray-300: #D9D9D5;
    --gray-500: #888880;
    --gray-700: #4A4A45;
    --gray-900: #2D2D2A;
    
    --red: #C0392B;
    
    /* Spacing */
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-3: 0.75rem;
    --spacing-4: 1rem;
    --spacing-5: 1.25rem;
    --spacing-6: 1.5rem;
    --spacing-8: 2rem;
    --spacing-10: 2.5rem;
    --spacing-12: 3rem;
    
    /* Border radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(13, 92, 58, 0.05);
    --shadow-md: 0 4px 6px rgba(13, 92, 58, 0.1);
    --shadow-lg: 0 8px 24px rgba(13, 92, 58, 0.15);
    --shadow-xl: 0 24px 60px rgba(13, 92, 58, 0.3);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Background ───────────────────────────────────────────────────────── */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, #1B4D35 0%, #0F3A28 100%);
    background-image: 
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="rgba(201,168,76,0.15)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    background-attachment: fixed;
    z-index: -1;
}

/* ─── Container ────────────────────────────────────────────────────────── */
.container {
    max-width: 500px;
    margin: 0 auto;
    padding: var(--spacing-6) var(--spacing-4);
    position: relative;
    z-index: 1;
}

/* ─── Header ───────────────────────────────────────────────────────────── */
.header {
    text-align: center;
    margin-bottom: var(--spacing-8);
    animation: fadeInDown 0.5s ease-out;
}

.header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: rgba(201, 168, 76, 0.2);
    border: 1px solid rgba(201, 168, 76, 0.4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-3);
    color: var(--gold-400);
}

.header-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--emerald-50);
    margin-bottom: var(--spacing-1);
    letter-spacing: -0.5px;
}

.header-text h1 .accent {
    color: var(--gold-400);
}

.header-text p {
    font-size: 0.875rem;
    color: rgba(232, 245, 240, 0.7);
    font-weight: 400;
}

/* ─── Cards ────────────────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius-2xl);
    box-shadow: 0 24px 60px rgba(13, 92, 58, 0.5), 0 4px 16px rgba(13, 92, 58, 0.3);
    overflow: hidden;
    animation: fadeInUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
}

.main-card {
    animation-delay: 0.1s;
    margin-bottom: var(--spacing-6);
}

.info-card {
    animation-delay: 0.25s;
    margin-bottom: var(--spacing-6);
}

.history-card {
    animation-delay: 0.3s;
}

/* ─── Input Section ────────────────────────────────────────────────────── */
.input-section {
    padding: var(--spacing-8) var(--spacing-6) var(--spacing-6);
    border-bottom: 1px solid var(--gray-200);
}

.input-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: var(--spacing-4);
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-6);
}

.currency-symbol {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--emerald-900);
    flex-shrink: 0;
}

.amount-input {
    flex: 1;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    background: transparent;
    border: none;
    outline: none;
    color: var(--gray-900);
    caret-color: var(--gold-500);
    width: 100%;
}

.amount-input::placeholder {
    color: rgba(74, 74, 69, 0.4);
    font-weight: 400;
}

.amount-input:focus {
    outline: none;
}

.clear-btn {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-lg);
    background: var(--gray-100);
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.clear-btn:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

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

/* ─── Quick Amounts ────────────────────────────────────────────────────── */
.quick-amounts {
    display: flex;
    gap: var(--spacing-2);
    flex-wrap: wrap;
}

.quick-btn {
    font-size: 0.75rem;
    padding: var(--spacing-2) var(--spacing-3);
    border-radius: var(--radius-md);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--emerald-900);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-btn:hover {
    background: var(--gray-200);
    transform: scale(1.05);
}

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

/* ─── Results Section ──────────────────────────────────────────────────── */
.results-section {
    padding: var(--spacing-6);
    animation: fadeIn 0.3s ease-out;
}

.result-box {
    border-radius: var(--radius-xl);
    padding: var(--spacing-5);
    margin-bottom: var(--spacing-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gmf-box {
    background: linear-gradient(135deg, #1B4D35 0%, #1B7A52 100%);
}

.net-box {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
}

.result-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    flex: 1;
}

.result-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gmf-icon {
    background: rgba(201, 168, 76, 0.2);
    color: var(--gold-400);
}

.net-icon {
    background: rgba(13, 92, 58, 0.12);
    color: var(--emerald-900);
}

.result-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-1);
}

.gmf-box .result-label {
    color: rgba(232, 245, 240, 0.9);
}

.net-box .result-label {
    color: var(--gray-500);
}

.result-sublabel {
    font-size: 0.75rem;
    margin: 0;
}

.gmf-box .result-sublabel {
    color: rgba(232, 245, 240, 0.7);
}

.net-box .result-sublabel {
    color: var(--gray-500);
}

.result-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.gmf-value {
    color: var(--gold-400);
}

.net-value {
    color: var(--emerald-900);
}

/* ─── Distribution Bar ────────────────────────────────────────────────── */
.distribution-bar {
    margin-top: var(--spacing-4);
}

.bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: var(--spacing-3);
}

.bar-container {
    height: 0.5rem;
    background: var(--gray-200);
    border-radius: 9999px;
    overflow: hidden;
    display: flex;
    margin-bottom: var(--spacing-3);
}

.bar-fill {
    background: var(--emerald-900);
    border-radius: 9999px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-tax {
    background: var(--gold-500);
    border-radius: 9999px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    min-width: 6px;
}

.bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-family: 'IBM Plex Mono', monospace;
}

.bar-labels span:first-child {
    color: var(--emerald-900);
}

.bar-labels span:last-child {
    color: var(--gold-500);
}

/* ─── Save Button ──────────────────────────────────────────────────────── */
.save-btn {
    width: 100%;
    padding: var(--spacing-3) var(--spacing-4);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, var(--emerald-900) 0%, var(--emerald-800) 100%);
    color: var(--emerald-50);
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: var(--spacing-4);
}

.save-btn:hover {
    opacity: 0.9;
}

.save-btn:active {
    transform: scale(0.98);
}

/* ─── Empty State ──────────────────────────────────────────────────────── */
.empty-state {
    padding: var(--spacing-10) var(--spacing-6);
    text-align: center;
}

.empty-icon {
    width: 3.5rem;
    height: 3.5rem;
    background: var(--gray-100);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-4);
    color: var(--gray-500);
}

.empty-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: var(--spacing-2);
}

.empty-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
    opacity: 0.8;
}

/* ─── Card Header (Collapsible) ────────────────────────────────────────── */
.card-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-5);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.card-header:hover {
    background: var(--gray-50);
}

.card-header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    flex: 1;
}

.card-header-left svg {
    color: var(--gold-500);
    flex-shrink: 0;
}

.card-header-left span {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
}

.card-header .chevron {
    color: var(--gray-500);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.card-header.active .chevron {
    transform: rotate(180deg);
}

.card-header.active {
    border-bottom-color: var(--gray-200);
}

/* ─── Card Content ────────────────────────────────────────────────────── */
.card-content {
    padding: var(--spacing-6);
    border-top: 1px solid var(--gray-200);
    animation: slideDown 0.3s ease-out;
}

/* ─── Info Grid ────────────────────────────────────────────────────────── */
.info-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-4);
    margin-bottom: var(--spacing-4);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--spacing-3);
}

.info-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    flex-shrink: 0;
}

.info-value {
    font-size: 0.75rem;
    text-align: right;
    font-weight: 500;
    color: var(--gray-900);
}

.info-value.mono {
    font-family: 'IBM Plex Mono', monospace;
}

.info-note {
    background: rgba(201, 168, 76, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--spacing-3);
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgba(192, 57, 43, 0.8);
}

.info-note strong {
    color: var(--gray-900);
}

/* ─── History Badge ────────────────────────────────────────────────────── */
.history-badge {
    font-size: 0.7rem;
    padding: 0.2rem var(--spacing-2);
    border-radius: 9999px;
    background: var(--emerald-900);
    color: var(--emerald-50);
    font-weight: 700;
    margin-left: var(--spacing-2);
}

/* ─── History List ────────────────────────────────────────────────────── */
.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
    max-height: 18rem;
    overflow-y: auto;
    margin-bottom: var(--spacing-4);
}

.history-item {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--spacing-3) var(--spacing-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    animation: slideIn 0.25s ease-out;
}

.history-item:hover {
    background: var(--gray-200);
}

.history-item-info p {
    margin: 0;
}

.history-item-amount {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-900);
}

.history-item-details {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: var(--spacing-1);
}

.history-item-details span {
    margin: 0 var(--spacing-2);
}

.history-item-tax {
    color: var(--gold-500);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
}

.history-item-delete {
    background: rgba(192, 57, 43, 0.1);
    color: var(--red);
    border: none;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0;
    flex-shrink: 0;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: rgba(192, 57, 43, 0.2);
}

/* ─── Clear History Button ────────────────────────────────────────────── */
.clear-history-btn {
    width: 100%;
    padding: var(--spacing-2) var(--spacing-4);
    border-radius: var(--radius-lg);
    background: rgba(192, 57, 43, 0.08);
    border: none;
    color: var(--red);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-history-btn:hover {
    background: rgba(192, 57, 43, 0.15);
}

/* ─── Footer ───────────────────────────────────────────────────────────── */
.footer {
    text-align: center;
    font-size: 0.75rem;
    color: rgba(232, 245, 240, 0.5);
    padding: var(--spacing-6) 0;
    animation: fadeIn 0.5s ease-out 0.5s both;
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

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

/* ─── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .container {
        padding: var(--spacing-4);
    }

    .header {
        margin-bottom: var(--spacing-6);
    }

    .header-text h1 {
        font-size: 1.5rem;
    }

    .amount-input {
        font-size: 2rem;
    }

    .result-value {
        font-size: 1.125rem;
    }

    .card {
        border-radius: var(--radius-xl);
    }
}

/* ─── Scrollbar personalizado ──────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--emerald-900);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--emerald-800);
}
