:root {
    /* Paleta de colores premium (Estilo institucional moderno) */
    --primary: #10B981;       /* Verde vibrante y fresco */
    --primary-dark: #059669;
    --primary-light: #D1FAE5;
    --secondary: #F59E0B;     /* Dorado/Naranja para contrastes */
    --background: #0F172A;    /* Azul muy oscuro, casi negro, modo oscuro por defecto */
    --surface: rgba(30, 41, 59, 0.7); /* Glassmorphism background */
    --surface-border: rgba(255, 255, 255, 0.1);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --danger: #EF4444;
    --font-family: 'Outfit', sans-serif;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--background);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* Force elements to stack vertically */
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    padding: 2rem 1rem;
}

/* Background animated shapes */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite alternate ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: #3B82F6; /* Azul para complementar */
    bottom: 10%;
    right: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: var(--secondary);
    bottom: -50px;
    left: 20%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(50px, 50px) rotate(20deg); }
}

/* App Container */
.app-container {
    width: 100%;
    max-width: 540px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.app-header {
    text-align: center;
    animation: fadeInDown 0.8s ease-out;
}

.logo-container {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surface-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.shield-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(to right, #ffffff, #94A3B8);
    -webkit-background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 400;
}

/* Glassmorphism Card Base */
.calculator-card, .payment-date-card, .breakdown-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.8s ease-out;
}

/* Form Styles */
.input-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.row-group {
    flex-direction: row;
    gap: 1rem;
}

.half-width {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

input[type="number"],
input[type="text"],
select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    font-size: 1rem;
    color: white;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    background: rgba(15, 23, 42, 0.8);
}

/* Custom Currency Input */
.currency-input {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 1.2rem;
    color: var(--text-muted);
    font-weight: 600;
    pointer-events: none;
}

.currency-input input {
    padding-left: 2.5rem;
}

/* Custom Select Wrapper */
.select-wrapper {
    position: relative;
}
.select-wrapper::after {
    content: '▼';
    font-size: 0.8rem;
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

select {
    appearance: none;
    cursor: pointer;
}

select option {
    background: #1E293B;
    color: white;
}

/* Buttons */
.btn-calculate, .btn-reset {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: none;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-calculate {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    margin-top: 1rem;
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(16, 185, 129, 0.5);
}

.btn-calculate:active {
    transform: translateY(0);
}

/* Results Section */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: all 0.5s ease;
}

.results-section.hidden {
    display: none;
    opacity: 0;
}

/* Payment Date Card - WOW factor */
.payment-date-card {
    text-align: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
    border-top: 4px solid var(--primary);
}

.payment-date-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.payment-date-card h3 {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.big-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    margin-bottom: 1rem;
}

.big-date .day {
    font-size: 5rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.big-date .month {
    font-size: 2rem;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
}

.date-detail {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(245, 158, 11, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Breakdown Card */
.breakdown-card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-bottom: 1px solid var(--surface-border);
    padding-bottom: 1rem;
}

.breakdown-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.breakdown-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breakdown-list .label {
    color: var(--text-muted);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auto-badge {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.breakdown-list .value {
    font-weight: 600;
    font-size: 1.05rem;
}

.total-divider {
    height: 1px;
    background: var(--surface-border);
    margin: 1.5rem 0;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-label {
    font-size: 1.2rem;
    font-weight: 600;
}

.total-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary);
}

.btn-reset {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-main);
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

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

/* Responsive */
@media (max-width: 768px) {
    .calculator-card, .payment-date-card, .breakdown-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .app-container {
        gap: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .calculator-card, .payment-date-card, .breakdown-card {
        padding: 1.25rem;
    }

    .row-group {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .big-date .day {
        font-size: 3.5rem;
    }
    
    .big-date .month {
        font-size: 1.25rem;
    }
    
    .total-value {
        font-size: 1.4rem;
    }

    .breakdown-list .label {
        font-size: 0.85rem;
    }

    .breakdown-list .value {
        font-size: 0.95rem;
    }

    .resultado-nombre {
        font-size: 1.25rem;
    }

    .app-footer {
        font-size: 0.65rem;
        padding: 0.5rem;
    }
}

/* Footer & Name Display */
.resultado-nombre {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    text-transform: capitalize;
    margin-bottom: 0.5rem;
}

.app-footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Status Alert Styles */
.status-alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
    font-weight: 600;
}

.periodo-text {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

.mora-alert {
    background-color: rgba(239, 68, 68, 0.15); /* Red transparent */
    border: 2px solid var(--danger);
    color: #FCA5A5;
    animation: pulse-danger 2s infinite;
}

.okay-alert {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary-light);
}

@keyframes pulse-danger {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
