/* ============================================
   PANEL RRHH - ERP Coral v14
   ============================================ */

:root {
    --bg-darkest: #0a0a0f;
    --bg-darker: #12121a;
    --bg-dark: #1a1a24;
    --bg-card: #1e1e2a;
    --bg-hover: #2a2a3a;
    --border: #2d2d3d;
    --text-primary: #ffffff;
    --text-muted: #8888aa;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-darkest);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ==================== LOGIN ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-darkest) 0%, var(--bg-darker) 100%);
}

.login-container.hidden { display: none; }

.login-box {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    border: 1px solid var(--border);
}

.login-logo { font-size: 64px; margin-bottom: 10px; }
.login-title { font-size: 24px; font-weight: 700; margin-bottom: 5px; }
.login-subtitle { color: var(--text-muted); margin-bottom: 30px; }

.pin-display {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.pin-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-darker);
    border: 2px solid var(--border);
    transition: all 0.2s;
}

.pin-dot.filled {
    background: var(--accent);
    border-color: var(--accent);
}

.pin-dot.error {
    background: var(--danger);
    border-color: var(--danger);
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 240px;
    margin: 0 auto;
}

.keypad-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    background: var(--bg-hover);
    color: white;
    font-size: 24px;
    cursor: pointer;
    margin: 0 auto;
    transition: all 0.2s;
}

.keypad-btn:hover { background: var(--accent); color: #000; }
.keypad-btn:active { transform: scale(0.95); }

/* ==================== APP CONTAINER ==================== */
.app-container { display: none; }
.app-container.visible { display: block; }

/* ==================== HEADER ==================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-dark);
    border-bottom: 3px solid var(--accent);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title { font-size: 20px; font-weight: 700; }
.header-subtitle { font-size: 12px; color: var(--text-muted); }

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ==================== NAVEGACION ==================== */
.nav-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.nav-tab {
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* ==================== MAIN & SECTIONS ==================== */
.main { padding: 24px; }

.section { display: none; }
.section.active { display: block; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 { font-size: 24px; font-weight: 600; }

.header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ==================== STATS ==================== */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 120px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.filtros-card {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filtros-card .form-group {
    flex: 1;
    min-width: 150px;
}

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 12px; }

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h4 {
    color: var(--accent);
    margin-bottom: 16px;
    font-size: 14px;
}

/* ==================== TABLES ==================== */
.table-container { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--bg-darker);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    position: sticky;
    top: 0;
}

.table tbody tr:hover td { background: var(--bg-hover); }

.text-center { text-align: center; }

/* ==================== BUTTONS ==================== */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #0d9668; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ==================== BADGES ==================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.badge-info { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }

.antiguedad-badge {
    background: var(--accent);
    color: #000;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}

/* ==================== MODALS ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-lg { max-width: 900px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.modal-header h3 { font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 20px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
}

/* ==================== INFO BOX ==================== */
.info-box {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius);
    padding: 15px;
    color: var(--info);
}

.info-box ul {
    margin-left: 20px;
    margin-top: 8px;
}

.info-box li { margin-bottom: 4px; }

/* ==================== TOAST ==================== */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    min-width: 250px;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-warning { background: var(--warning); color: black; }
.toast-info { background: var(--info); color: white; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .filtros-card { flex-direction: column; }
    
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 12px;
    }
    
    .nav-tab {
        white-space: nowrap;
        padding: 10px 16px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-row { flex-direction: column; }
    
    .stat-card { min-width: 100%; }
    
    .modal { max-width: 95%; }
    
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}
