/* ============================================================
   Admin Panel CSS - Junta Comunal Santa Ana
   ============================================================ */

:root {
    --primary: #c0392b;
    --primary-dark: #962d22;
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
    --sidebar-active: #c0392b;
    --text-muted: #94a3b8;
    --card-shadow: 0 2px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    margin: 0;
}

/* ---- Wrapper ---- */
.admin-wrapper { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-align: center;
}

.sidebar-brand img { max-width: 80px; margin-bottom: 8px; }
.sidebar-brand h4 { color: #fff; font-size: 14px; margin: 0; font-weight: 600; }
.sidebar-brand small { color: var(--text-muted); font-size: 11px; }

.sidebar-nav { padding: 16px 0; flex: 1; }
.sidebar-section {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 12px 20px 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    transition: background .2s, color .2s;
}

.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.sidebar-nav a i { width: 18px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a {
    display: flex; align-items: center; gap: 10px;
    color: #94a3b8; text-decoration: none; font-size: 13px;
}
.sidebar-footer a:hover { color: #fff; }

/* ---- Main Content ---- */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 28px;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.topbar-title { font-size: 18px; font-weight: 700; color: #1e293b; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #64748b; }
.topbar-user strong { color: #1e293b; }

/* ---- Page content ---- */
.page-content { padding: 28px; }

/* ---- Cards ---- */
.card-admin {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
    overflow: hidden;
}
.card-admin-header {
    padding: 16px 22px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-admin-header h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}
.card-admin-body { padding: 22px; }

/* ---- Stat Cards (dashboard) ---- */
.stat-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
}
.stat-card-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff; flex-shrink: 0;
}
.stat-card-icon.red { background: var(--primary); }
.stat-card-icon.blue { background: #2563eb; }
.stat-card-icon.green { background: #16a34a; }
.stat-card-icon.orange { background: #ea580c; }
.stat-card-icon.purple { background: #7c3aed; }
.stat-card-label { font-size: 12px; color: #64748b; font-weight: 500; margin-bottom: 2px; }
.stat-card-value { font-size: 26px; font-weight: 800; color: #1e293b; }

/* ---- Tables ---- */
.table-admin { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-admin th {
    background: #f8fafc; padding: 12px 16px;
    text-align: left; font-weight: 600; color: #64748b;
    font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
    border-bottom: 1px solid #e2e8f0;
}
.table-admin td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table-admin tr:hover td { background: #f8fafc; }
.table-admin img { width: 60px; height: 45px; object-fit: cover; border-radius: 6px; }

/* ---- Badges ---- */
.badge-status {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.badge-activo, .badge-publicado { background: #dcfce7; color: #15803d; }
.badge-inactivo, .badge-borrador { background: #fee2e2; color: #b91c1c; }

/* ---- Buttons ---- */
.btn-admin {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; border-radius: 8px; font-size: 14px;
    font-weight: 600; cursor: pointer; text-decoration: none;
    border: none; transition: .2s;
}
.btn-primary-admin { background: var(--primary); color: #fff; }
.btn-primary-admin:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary-admin { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary-admin:hover { background: #e2e8f0; }
.btn-danger-admin { background: #fee2e2; color: #b91c1c; }
.btn-danger-admin:hover { background: #fecaca; }
.btn-sm-admin { padding: 5px 12px; font-size: 12px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-control-admin {
    width: 100%; padding: 10px 14px; border: 1.5px solid #e2e8f0;
    border-radius: 8px; font-size: 14px; color: #1e293b;
    transition: border-color .2s, box-shadow .2s;
    background: #fff;
}
.form-control-admin:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(192,57,43,.12);
}
textarea.form-control-admin { resize: vertical; min-height: 100px; }
select.form-control-admin { cursor: pointer; }

.form-hint { font-size: 12px; color: #94a3b8; margin-top: 4px; }

/* ---- Image Preview ---- */
.img-preview {
    width: 120px; height: 80px; object-fit: cover;
    border-radius: 8px; border: 2px solid #e2e8f0; margin-top: 8px;
    display: block;
}
.img-preview-large { width: 100%; max-width: 400px; height: 200px; object-fit: cover; }

/* ---- Alerts ---- */
.alert-admin {
    padding: 14px 18px; border-radius: 8px; font-size: 14px;
    margin-bottom: 20px; display: flex; align-items: flex-start; gap: 10px;
    border-left: 4px solid transparent;
}
.alert-success { background: #f0fdf4; color: #15803d; border-color: #16a34a; }
.alert-error   { background: #fef2f2; color: #b91c1c; border-color: #dc2626; }
.alert-info    { background: #eff6ff; color: #1d4ed8; border-color: #2563eb; }

/* ---- Toggle Switch ---- */
.toggle-label {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; font-size: 14px; color: #374151;
}
.toggle-label input[type="checkbox"] { display: none; }
.toggle-switch {
    width: 42px; height: 22px; background: #cbd5e1;
    border-radius: 50px; position: relative; transition: .3s;
}
.toggle-switch::after {
    content: ''; position: absolute;
    width: 18px; height: 18px; background: #fff;
    border-radius: 50%; top: 2px; left: 2px; transition: .3s;
}
.toggle-label input:checked + .toggle-switch { background: var(--primary); }
.toggle-label input:checked + .toggle-switch::after { left: 22px; }

/* ---- Login page ---- */
.login-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, var(--primary) 100%);
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 16px; padding: 44px 42px;
    width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h2 { font-size: 22px; font-weight: 800; color: #1e293b; }
.login-logo p { color: #64748b; font-size: 14px; margin-top: 4px; }
.login-btn {
    width: 100%; padding: 12px; background: var(--primary);
    color: #fff; border: none; border-radius: 8px; font-size: 15px;
    font-weight: 700; cursor: pointer; transition: background .2s;
}
.login-btn:hover { background: var(--primary-dark); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-260px); transition: transform .3s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
}

/* ---- Color chip ---- */
.color-chip {
    display: inline-block; width: 18px; height: 18px;
    border-radius: 4px; border: 1px solid #e2e8f0;
    vertical-align: middle; margin-right: 6px;
}
