/* ── Admin Panel CSS ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=Poppins:wght@600;700;800&display=swap');

:root {
    --sb-bg:      #1E1410;
    --sb-width:   260px;
    --top-h:      64px;
    --primary:    #C41E3A;
    --gold:       #C9A030;
    --dark:       #3D2B1F;
    --cream:      #FDF8F0;
    --border:     #E8D5BE;
    --white:      #FFFFFF;
    --success:    #198754;
    --danger:     #dc3545;
    --warning:    #ffc107;
    --info:       #0dcaf0;
    --radius:     10px;
    --shadow:     0 2px 12px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Nunito', sans-serif; background: #F4F0EA; color: #2C1810; }

/* ─── Sidebar ───────────────────────────────────────────── */
#adminSidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sb-width);
    height: 100vh;
    background: var(--sb-bg);
    overflow-y: auto;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease;
}
.sidebar-brand {
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand img {
    width: 44px; height: 44px;
    border-radius: 8px;
    object-fit: cover;
}
.sidebar-brand span {
    font-family: 'Poppins', sans-serif;
    font-size: .95rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1.2;
}
.sidebar-nav { padding: 12px 10px 20px; flex: 1; }
.nav-group-label {
    font-size: .7rem;
    font-weight: 800;
    color: rgba(255,255,255,.3);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 14px 10px 6px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,.7);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all .2s;
    margin-bottom: 2px;
    position: relative;
}
.nav-item i { font-size: 1rem; min-width: 18px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item.active i { color: #fff; }
.nav-item.text-danger-soft { color: rgba(220,53,69,.8); }
.nav-item.text-danger-soft:hover { background: rgba(220,53,69,.12); color: #dc3545; }
.sidebar-divider { border-top: 1px solid rgba(255,255,255,.08); margin: 10px 0; }
.msg-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 50px;
}

/* ─── Main ──────────────────────────────────────────────── */
#adminMain {
    margin-left: var(--sb-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin .3s ease;
}

/* ─── Topbar ────────────────────────────────────────────── */
#adminTopbar {
    height: var(--top-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
#sidebarToggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--dark);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}
#sidebarToggle:hover { background: #F4F0EA; }
.topbar-left { flex: 1; }
.topbar-title { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 1rem; color: var(--dark); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-btn {
    position: relative;
    width: 38px; height: 38px;
    background: #F4F0EA;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--dark);
    font-size: 1rem;
    text-decoration: none;
    transition: all .2s;
}
.topbar-btn:hover { background: var(--gold); color: var(--dark); }
.topbar-badge {
    position: absolute;
    top: -2px; right: -2px;
    background: var(--primary); color: #fff;
    font-size: .6rem; font-weight: 800;
    padding: 1px 5px;
    border-radius: 50px;
    border: 2px solid #fff;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
    font-weight: 700;
    color: var(--dark);
}
.topbar-user i { font-size: 1.4rem; color: var(--gold); }

/* ─── Content ───────────────────────────────────────────── */
#adminContent { padding: 28px; flex: 1; }

/* ─── Cards ─────────────────────────────────────────────── */
.admin-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.admin-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.admin-card-header h5 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: .95rem;
    color: var(--dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.admin-card-header h5 i { color: var(--primary); }
.admin-card-body { padding: 20px; }

/* ─── Stat Cards ─────────────────────────────────────────── */
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 22px 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.stat-card-icon {
    width: 56px; height: 56px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    flex-shrink: 0;
}
.stat-card-icon.red   { background: linear-gradient(135deg, var(--primary), #9B1429); }
.stat-card-icon.gold  { background: linear-gradient(135deg, var(--gold), #9E7D20); }
.stat-card-icon.green { background: linear-gradient(135deg, #198754, #0f5132); }
.stat-card-icon.blue  { background: linear-gradient(135deg, #0d6efd, #0943a3); }
.stat-card-info h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-card-info p { font-size: .82rem; color: #6c757d; margin: 0; font-weight: 600; }

/* ─── Table ──────────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.admin-table thead th {
    background: #F4F0EA;
    color: var(--dark);
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.admin-table tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #F4F0EA;
    font-size: .88rem;
    color: #2C1810;
    vertical-align: middle;
}
.admin-table tbody tr:hover td { background: #FDFAF5; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.table-img {
    width: 50px; height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--border);
}
.table-no-img {
    width: 50px; height: 50px;
    border-radius: 8px;
    background: var(--border);
    display: flex; align-items: center; justify-content: center;
    color: #aaa;
    font-size: 1.2rem;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn-admin-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: .88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    transition: all .2s;
}
.btn-admin-primary:hover { background: #9B1429; color: #fff; transform: translateY(-1px); }
.btn-admin-gold {
    background: var(--gold);
    color: var(--dark);
    border: none;
    padding: 9px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: .88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    transition: all .2s;
}
.btn-admin-gold:hover { background: #9E7D20; color: var(--dark); transform: translateY(-1px); }
.btn-admin-sm {
    padding: 6px 14px;
    font-size: .8rem;
    border-radius: 6px;
}
.btn-admin-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; cursor: pointer;
    font-size: .9rem;
    text-decoration: none;
    transition: all .2s;
}
.btn-edit   { background: #fff3cd; color: #856404; }
.btn-edit:hover   { background: #ffc107; color: #000; }
.btn-delete { background: #f8d7da; color: #842029; }
.btn-delete:hover { background: #dc3545; color: #fff; }
.btn-view   { background: #cff4fc; color: #055160; }
.btn-view:hover   { background: #0dcaf0; color: #000; }
.btn-toggle-active   { background: #d1e7dd; color: #0a3622; }
.btn-toggle-inactive { background: #f8d7da; color: #842029; }

/* ─── Form ───────────────────────────────────────────────── */
.form-label-admin {
    font-weight: 700;
    font-size: .88rem;
    color: var(--dark);
    margin-bottom: 6px;
    display: block;
}
.form-control-admin {
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Nunito', sans-serif;
    font-size: .9rem;
    background: #FDFAF5;
    color: var(--dark);
    transition: all .2s;
    width: 100%;
}
.form-control-admin:focus {
    border-color: var(--gold);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(201,160,48,.15);
    outline: none;
}
.form-select-admin {
    appearance: auto;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'Nunito', sans-serif;
    font-size: .9rem;
    background: #FDFAF5;
    color: var(--dark);
    transition: all .2s;
    width: 100%;
}
.form-select-admin:focus {
    border-color: var(--gold);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(201,160,48,.15);
    outline: none;
}
.img-preview-wrap {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 12px;
    display: inline-block;
    background: #FDFAF5;
}
.img-preview-wrap img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
}
.form-hint { font-size: .78rem; color: #6c757d; margin-top: 4px; }

/* ─── Badge ──────────────────────────────────────────────── */
.badge-status {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 800;
}
.badge-active   { background: #d1e7dd; color: #0a3622; }
.badge-inactive { background: #f8d7da; color: #842029; }
.badge-adopted  { background: #cff4fc; color: #055160; }
.badge-product  { background: #fff3cd; color: #856404; }
.badge-animal   { background: #f0d7fb; color: #5a0080; }

/* ─── Alert ──────────────────────────────────────────────── */
.alert-admin { border-radius: 10px; border: none; font-weight: 600; padding: 14px 18px; }

/* ─── Pagination ─────────────────────────────────────────── */
.pagination-admin { display: flex; gap: 6px; align-items: center; }
.page-btn {
    padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: .85rem;
    background: var(--white); border: 1px solid var(--border); color: var(--dark);
    text-decoration: none; transition: all .2s;
}
.page-btn:hover, .page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ─── Login ──────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1E1410 0%, #3D2B1F 50%, #5C2020 100%);
    display: flex; align-items: center; justify-content: center;
}
.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 40px;
    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 img { height: 80px; }
.login-title { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 1.4rem; color: var(--dark); text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; font-size: .88rem; color: #6c757d; margin-bottom: 28px; }

/* ─── Image upload multi ─────────────────────────────────── */
.img-upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    background: #FDFAF5;
}
.img-upload-area:hover { border-color: var(--gold); background: #FFF9ED; }
.img-upload-area.drag-over { border-color: var(--primary); background: #FFF0F2; border-style: solid; }
.img-upload-area.drag-over i { color: var(--primary); }
.img-upload-area.has-files { border-color: var(--gold); border-style: solid; background: #FFF9ED; }
.img-upload-area.has-files i { color: var(--gold); }
.img-upload-area.has-files p { color: var(--gold-dark); }
.img-upload-area i { font-size: 2.5rem; color: var(--border); display: block; margin-bottom: 10px; transition: color .2s; }
.img-upload-area p { font-size: .88rem; color: #6c757d; margin: 0; font-weight: 600; }

.img-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}
.img-preview-item {
    position: relative;
    width: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--gold);
    background: #FDFAF5;
}
.img-preview-item img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}
.img-preview-info {
    padding: 5px 6px;
}
.img-preview-name {
    font-size: .68rem;
    font-weight: 700;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.img-preview-size {
    font-size: .65rem;
    color: #888;
}
.img-preview-remove {
    position: absolute;
    top: 3px; right: 3px;
    width: 20px; height: 20px;
    background: rgba(220,53,69,.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem;
    line-height: 1;
    font-weight: 700;
}
.img-thumbnails { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.img-thumb-item {
    position: relative;
    width: 90px; height: 90px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
}
.img-thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.img-thumb-item .remove-img {
    position: absolute;
    top: 3px; right: 3px;
    width: 20px; height: 20px;
    background: rgba(220,53,69,.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: .6rem;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 991px) {
    #adminSidebar { transform: translateX(-100%); }
    body.sidebar-open #adminSidebar { transform: translateX(0); }
    body.sidebar-open #sidebarOverlay { display: block; }
    #sidebarOverlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 1039;
    }
    #adminMain { margin-left: 0; }
    #sidebarToggle { display: flex; }
    #adminContent { padding: 18px; }
}
@media (max-width: 575px) {
    .admin-card-header { flex-direction: column; align-items: flex-start; }
    .stat-card { flex-direction: column; text-align: center; }
}
