/* ========== VARIABLES Y RESET ========== */
:root {
    --color-primary: #1a73e8;
    --color-primary-dark: #1557b0;
    --color-success: #0d904f;
    --color-danger: #d93025;
    --color-warning: #f9ab00;
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #202124;
    --color-text-secondary: #5f6368;
    --color-border: #dadce0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --transition: 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #1a1a2e;
        --color-surface: #16213e;
        --color-text: #e8eaed;
        --color-text-secondary: #9aa0a6;
        --color-border: #3c4043;
        --shadow: 0 1px 3px rgba(0,0,0,0.3);
    }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* ========== PANTALLA DE CARGA ========== */
.loading-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========== APP CONTAINER ========== */
.app-container {
    max-width: 768px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
}

/* ========== HEADER ========== */
.app-header {
    background: var(--color-primary);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-title {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover { background: rgba(255,255,255,0.3); }
.btn-icon:active { transform: scale(0.95); }

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    padding: 20px;
    padding-bottom: 80px;
    overflow-y: auto;
}

/* ========== BOTTOM NAV ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 768px;
    margin: 0 auto;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 10;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.nav-btn i { font-size: 1.3rem; }
.nav-btn.active { color: var(--color-primary); }
.nav-btn:active { transform: scale(0.95); }

/* ========== BOTONES ========== */
.btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}

.btn:hover { background: var(--color-primary-dark); }
.btn:active { transform: scale(0.97); }

.btn-success { background: var(--color-success); }
.btn-danger { background: var(--color-danger); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 8px 16px; font-size: 0.9rem; }

/* ========== INPUTS ========== */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--color-surface);
    color: var(--color-text);
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2);
}

/* ========== TARJETAS ========== */
.card {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

/* ========== LISTA DE EMPLEADOS ========== */
.employee-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.employee-item:hover { background: var(--color-bg); }
.employee-item:active { transform: scale(0.99); }

.employee-name {
    font-weight: 600;
    font-size: 1rem;
}

.employee-dni {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}

/* ========== BÚSQUEDA ========== */
.search-box {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1.5px solid var(--color-border);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--color-bg);
    margin-bottom: 16px;
}

.search-wrapper {
    position: relative;
}

.search-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
}

/* ========== RESUMEN DE PAGO ========== */
.summary-card {
    background: var(--color-bg);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
}

.summary-card h3 {
    margin-bottom: 12px;
    color: var(--color-primary);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.95rem;
}

.summary-total {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-success);
    text-align: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid var(--color-border);
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-container {
    background: var(--color-surface);
    border-radius: 20px 20px 0 0;
    padding: 24px 20px;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ========== TOAST ========== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 200;
    pointer-events: none;
}

.toast.show { opacity: 1; }

/* ========== LOGIN ========== */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--color-bg);
}

.login-card {
    background: var(--color-surface);
    border-radius: 20px;
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-logo {
    font-size: 3rem;
    color: var(--color-primary);
    margin-bottom: 10px;
}

/* ========== UTILIDADES ========== */
.text-center { text-align: center; }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-secondary { color: var(--color-text-secondary); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; gap: 8px; }
.flex-wrap { flex-wrap: wrap; }

/* ========== RESPONSIVE ========== */
@media (min-width: 768px) {
    .main-content { padding: 32px; }
    .bottom-nav { display: none; }
}