/* ==========================================================================
   Planilla Employee Portal - Design System
   Mobile-first responsive CSS with custom properties
   Mockup A accordion design
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */

:root {
    --planilla-primary: #1e40af;
    --planilla-primary-dark: #1e3a8a;
    --planilla-primary-light: #dbeafe;
    --planilla-accent: #3b82f6;
    --planilla-accent-light: #93c5fd;
    --planilla-success: #059669;
    --planilla-success-light: #d1fae5;
    --planilla-success-bg: #ecfdf5;
    --planilla-danger: #dc2626;
    --planilla-danger-light: #fecaca;
    --planilla-danger-bg: #fef2f2;
    --planilla-surface: #ffffff;
    --planilla-background: #f1f5f9;
    --planilla-text: #1e293b;
    --planilla-text-muted: #64748b;
    --planilla-text-secondary: #94a3b8;
    --planilla-border: #e2e8f0;
    --planilla-gradient-start: #0f172a;
    --planilla-gradient-mid: #1e3a5f;
    --planilla-gradient-end: #1e40af;
    --planilla-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    --planilla-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
    --planilla-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --planilla-radius: 0.75rem;
    --planilla-radius-sm: 0.5rem;
    --planilla-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

body {
    font-family: var(--planilla-font);
    background-color: var(--planilla-background);
    color: var(--planilla-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --------------------------------------------------------------------------
   Navbar (3-stop gradient)
   -------------------------------------------------------------------------- */

.planilla-navbar {
    background: linear-gradient(135deg, var(--planilla-gradient-start) 0%, var(--planilla-gradient-mid) 50%, var(--planilla-gradient-end) 100%);
    padding: 0.75rem 1rem;
    text-align: center;
}

.planilla-brand {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    line-height: 1.2;
}

.planilla-brand:hover {
    text-decoration: none;
}

.planilla-brand-name {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0;
    line-height: 1.2;
}

.planilla-brand-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Main Content
   -------------------------------------------------------------------------- */

.planilla-main {
    flex: 1;
    padding: 1rem;
}

/* --------------------------------------------------------------------------
   Login Card
   -------------------------------------------------------------------------- */

.planilla-login-card {
    background: var(--planilla-surface);
    border-radius: var(--planilla-radius);
    box-shadow: var(--planilla-shadow-lg);
    overflow: hidden;
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
}

.planilla-login-header {
    background: linear-gradient(135deg, var(--planilla-gradient-start) 0%, var(--planilla-gradient-mid) 50%, var(--planilla-gradient-end) 100%);
    color: #ffffff;
    padding: 1.25rem 1.5rem;
}

.planilla-login-body {
    padding: 1.5rem;
}

/* --------------------------------------------------------------------------
   Phone Input
   -------------------------------------------------------------------------- */

/* intl-tel-input overrides */
.iti {
    width: 100%;
}
.iti .iti__selected-country-primary {
    border-radius: var(--planilla-radius-sm) 0 0 var(--planilla-radius-sm);
}

/* --------------------------------------------------------------------------
   reCAPTCHA
   -------------------------------------------------------------------------- */

#recaptcha-container {
    margin-top: 1.25rem;
    margin-bottom: 1.5rem;
}

/* --------------------------------------------------------------------------
   OTP Input
   -------------------------------------------------------------------------- */

.planilla-otp-input {
    font-size: 1.5rem;
    letter-spacing: 0.5em;
    font-weight: 600;
    padding: 0.75rem;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.planilla-btn-primary {
    background: linear-gradient(135deg, var(--planilla-accent), var(--planilla-primary));
    border: none;
    color: #ffffff;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: var(--planilla-radius-sm);
    transition: opacity 0.15s ease-in-out, transform 0.1s ease-in-out;
}

.planilla-btn-primary:hover {
    opacity: 0.9;
    color: #ffffff;
}

.planilla-btn-primary:active {
    transform: scale(0.98);
}

.planilla-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */

.planilla-link {
    color: var(--planilla-accent);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.planilla-link:hover {
    color: var(--planilla-primary);
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Loading Overlay
   -------------------------------------------------------------------------- */

.planilla-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.planilla-loading-content {
    text-align: center;
}

/* --------------------------------------------------------------------------
   Alert Styles
   -------------------------------------------------------------------------- */

.planilla-alert {
    border-radius: var(--planilla-radius-sm);
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
}

/* --------------------------------------------------------------------------
   Utility
   -------------------------------------------------------------------------- */

.planilla-divider {
    border: none;
    border-top: 1px solid var(--planilla-border);
    margin: 0.75rem 0;
}

/* ==========================================================================
   Payroll Dashboard - Mockup A Accordion Design
   ========================================================================== */

/* --------------------------------------------------------------------------
   User Bar
   -------------------------------------------------------------------------- */

.user-bar {
    background: #ffffff;
    padding: 12px 16px 10px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.user-bar-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-greeting {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
}

/* Red square logout button */
.btn-logout {
    background: #ef4444;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-logout:hover,
.btn-logout:active {
    background: #dc2626;
}

.user-bar-subtitle {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
    font-weight: 400;
}

/* --------------------------------------------------------------------------
   Cards Container
   -------------------------------------------------------------------------- */

.cards-container {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --------------------------------------------------------------------------
   Payroll Card (Accordion)
   -------------------------------------------------------------------------- */

.payroll-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.payroll-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   Card Header Button (full width, no visible button styling)
   -------------------------------------------------------------------------- */

.card-header-btn {
    width: 100%;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.card-header-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
    border-radius: 12px 12px 0 0;
}

/* --------------------------------------------------------------------------
   Blue Gradient Strip on Card
   -------------------------------------------------------------------------- */

.card-gradient-strip {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e40af 100%);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-period-name {
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.2;
}

.card-period-dates {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.68rem;
    font-weight: 400;
    margin-top: 2px;
}

.card-chevron {
    color: #ffffff;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.card-chevron.expanded {
    transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   Liquido Summary (always visible below gradient strip)
   -------------------------------------------------------------------------- */

.card-liquido-summary {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-liquido-label {
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 500;
}

.card-liquido-amount {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e3a8a;
}

/* --------------------------------------------------------------------------
   Expandable Detail (Accordion Panel)
   -------------------------------------------------------------------------- */

.card-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.card-detail.open {
    max-height: 600px;
}

.card-detail-inner {
    padding: 0 14px 14px 14px;
}

/* --------------------------------------------------------------------------
   Section Labels (Income / Deductions)
   -------------------------------------------------------------------------- */

.section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    margin-top: 4px;
}

.section-label-text {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.section-label-text.income {
    color: #059669;
}

.section-label-text.deductions {
    color: #dc2626;
}

.section-label-line {
    flex: 1;
    height: 1px;
}

.section-label-line.income {
    background: #a7f3d0;
}

.section-label-line.deductions {
    background: #fecaca;
}

/* --------------------------------------------------------------------------
   Item Rows in Colored Containers
   -------------------------------------------------------------------------- */

.items-container {
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
}

.items-container.income {
    background: #ecfdf5;
}

.items-container.deductions {
    background: #fef2f2;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.item-row:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.item-name {
    font-size: 0.75rem;
    color: #475569;
    font-weight: 400;
}

.item-amount {
    font-size: 0.78rem;
    font-weight: 600;
    color: #1e293b;
}

/* --------------------------------------------------------------------------
   Section Totals
   -------------------------------------------------------------------------- */

.section-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 12px;
}

.section-total.income {
    background: #d1fae5;
}

.section-total.deductions {
    background: #fee2e2;
}

.section-total-label {
    font-size: 0.75rem;
    font-weight: 600;
}

.section-total-label.income {
    color: #047857;
}

.section-total-label.deductions {
    color: #b91c1c;
}

.section-total-amount {
    font-size: 0.82rem;
    font-weight: 700;
}

.section-total-amount.income {
    color: #047857;
}

.section-total-amount.deductions {
    color: #b91c1c;
}

/* --------------------------------------------------------------------------
   Liquido Bar (inside expanded card)
   -------------------------------------------------------------------------- */

.liquido-bar {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e40af 100%);
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.liquido-bar-label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.liquido-bar-amount {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 800;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.planilla-footer {
    text-align: center;
    padding: 16px 14px 20px 14px;
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: auto;
}

/* --------------------------------------------------------------------------
   Responsive: Tablet and up
   -------------------------------------------------------------------------- */

@media (min-width: 768px) {
    .planilla-main {
        padding: 1.5rem;
    }

    .planilla-login-card {
        max-width: 460px;
    }

    .cards-container {
        padding: 20px;
        gap: 16px;
    }
}

/* --------------------------------------------------------------------------
   Responsive: Desktop
   -------------------------------------------------------------------------- */

@media (min-width: 992px) {
    .planilla-main {
        padding: 2rem 1rem;
    }
}

/* --------------------------------------------------------------------------
   Accessibility: Focus styles
   -------------------------------------------------------------------------- */

*:focus-visible {
    outline: 2px solid var(--planilla-accent);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Reintegro Factura Portal
   -------------------------------------------------------------------------- */

.planilla-nav-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.planilla-nav-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: var(--planilla-radius-sm, 4px);
    transition: background-color 0.15s ease;
}

.planilla-nav-link:hover,
.planilla-nav-link:focus {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}

.factura-form {
    max-width: 640px;
    margin: 0 auto;
}

#preview-canvas {
    max-width: 100%;
    height: auto;
}

