/**
 * Admin Panel Styles v2.0
 */

:root {
    --primary: #1f286d;
    --primary-dark: #161d4f;
    --primary-light: #e8ebf7;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f1f5f9;
    --white: #ffffff;
    --sidebar-bg: #1f286d;
    --sidebar-text: #94a3b8;
    --sidebar-active: #3b82f6;
}

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

body { font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

/* ==================== LAYOUT ==================== */
.admin-body { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h2 { color: white; font-size: 1.1rem; }
.sidebar-user { font-size: 0.82rem; margin-top: 6px; }
.sidebar-user small { display: block; font-size: 0.72rem; opacity: 0.7; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.88rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active { background: rgba(59,130,246,0.15); color: white; border-left-color: var(--sidebar-active); }

.sidebar-footer { padding: 10px 0; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-footer .nav-item { color: #f87171; }
.sidebar-footer .nav-item:hover { background: rgba(239,68,68,0.15); }

.admin-main {
    flex: 1;
    margin-left: 240px;
    padding: 30px;
    max-width: calc(100vw - 240px);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.admin-header h1 { font-size: 1.5rem; color: var(--text); }
.admin-header p { font-size: 0.88rem; color: var(--text-muted); margin-top: 4px; }

/* ==================== LOGIN ==================== */
.login-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: var(--bg); }
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card { background: var(--white); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,0.1); padding: 40px 30px; }
.login-card h1 { font-size: 1.4rem; text-align: center; color: var(--primary); margin-bottom: 6px; }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 25px; }

/* ==================== CARDS ==================== */
.card { background: var(--white); border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); padding: 24px; margin-bottom: 20px; }
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: 12px; }

/* ==================== FORMS ==================== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 6px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 5px; }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.88rem;
    color: var(--text);
    transition: border-color 0.2s;
    font-family: inherit;
    background: var(--white);
}

.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(31,40,109,0.1); }

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

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ==================== STATS ==================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 25px; }
.stat-card { background: var(--white); border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border-left: 4px solid var(--primary); }
.stat-card.stat-warning { border-left-color: var(--warning); }
.stat-card.stat-success { border-left-color: var(--success); }
.stat-card.stat-danger { border-left-color: var(--danger); }
.stat-card.stat-info { border-left-color: var(--info); }
.stat-number { font-size: 2rem; font-weight: 800; color: var(--text); }
.stat-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }

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

.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table thead { background: var(--bg); }
.table th { padding: 10px 12px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: #f8fafc; }

/* ==================== BUTTONS ==================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 16px; border: none; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.15s; font-family: inherit; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--white); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-lg { padding: 11px 24px; font-size: 0.92rem; }

/* ==================== BADGES ==================== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-en_revision { background: #dbeafe; color: #1e40af; }
.badge-aprobado { background: #d1fae5; color: #065f46; }
.badge-rechazado { background: #fee2e2; color: #991b1b; }
.badge-suspendido { background: #f3f4f6; color: #374151; }
.badge-tipo { background: var(--primary-light); color: var(--primary); }
.badge-lg { font-size: 0.82rem; padding: 5px 14px; }

/* ==================== ALERTS ==================== */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 0.88rem; margin-bottom: 15px; }
.alert-success { background: #d1fae5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-error { background: #fee2e2; border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: #fef3c7; border: 1px solid #fde68a; color: #92400e; }
.alert-info { background: #dbeafe; border: 1px solid #bfdbfe; color: #1e40af; }

/* ==================== FILTERS ==================== */
.filter-form .filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-form .form-control { flex: 1; min-width: 150px; }

/* ==================== PAGINATION ==================== */
.pagination { display: flex; gap: 4px; justify-content: center; padding-top: 15px; }
.page-link { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 6px; font-size: 0.82rem; text-decoration: none; color: var(--text); background: var(--white); border: 1px solid var(--border); }
.page-link:hover { background: var(--bg); }
.page-link.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ==================== DETAIL VIEW ==================== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.detail-rows { display: flex; flex-direction: column; gap: 0; }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.detail-row span:first-child { color: var(--text-muted); }
.detail-row span:last-child { text-align: right; max-width: 60%; word-break: break-word; }

.areas-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.area-tag { background: var(--primary-light); color: var(--primary); padding: 6px 14px; border-radius: 20px; font-size: 0.82rem; }

.action-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* ==================== TIMELINE ==================== */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-left: 20px; padding-bottom: 16px; }
.timeline-item::before { content: ''; position: absolute; left: -17px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--white); }
.timeline-date { font-size: 0.75rem; color: var(--text-muted); }
.timeline-content { font-size: 0.88rem; margin-top: 2px; }

/* ==================== CATALOGS ==================== */
.catalogs-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.catalog-list { display: flex; flex-direction: column; gap: 4px; }
.catalog-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border: 1px solid var(--border); border-radius: 6px; transition: all 0.15s; }
.catalog-item:hover { border-color: var(--primary); }
.catalog-item-active { border-color: var(--primary); background: var(--primary-light); }
.catalog-item-inactive { opacity: 0.5; }
.catalog-item-link { text-decoration: none; color: var(--text); flex: 1; }
.catalog-count { font-size: 0.75rem; color: var(--text-muted); margin-left: 8px; }
.catalog-actions { display: flex; gap: 4px; }

/* ==================== HELPERS ==================== */
.text-danger { color: var(--danger); font-weight: 600; }
.text-warning { color: var(--warning); font-weight: 600; }
.text-success { color: var(--success); }

/* ==================== EXPORT & EXTRAS ==================== */
.btn-success { background: #27ae60; color: #fff; border: none; }
.btn-success:hover { background: #219a52; }

.filter-row input[type="date"] { max-width: 170px; padding: 7px 10px; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .sidebar-header h2, .sidebar .sidebar-user, .sidebar .nav-item span:not(:first-child), .sidebar .step-label { display: none; }
    .admin-main { margin-left: 60px; padding: 20px 15px; max-width: calc(100vw - 60px); }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .catalogs-layout { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .filter-form .filter-row { flex-direction: column; }
    .filter-row input[type="date"] { max-width: 100%; }
}
