/* ===================================================
   assets/css/admin.css - Admin Panel Styles
   =================================================== */

:root {
    --admin-primary: #2D6A4F;
    --admin-dark: #1B4332;
    --admin-light: #52B788;
    --admin-accent: #D8F3DC;
    --admin-sidebar-width: 260px;
    --admin-topbar-height: 64px;
    --admin-font: 'Plus Jakarta Sans', sans-serif;
    --admin-radius: 10px;
    --admin-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }

body {
    font-family: var(--admin-font);
    background: #f0f4f8;
    color: #1a2e1f;
    line-height: 1.6;
}

/* ===== SIDEBAR ===== */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--admin-sidebar-width);
    height: 100vh;
    background: var(--admin-dark);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-brand {
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-height: var(--admin-topbar-height);
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    background: var(--admin-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-brand-text .title {
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    display: block;
    line-height: 1.2;
}

.sidebar-brand-text .subtitle {
    color: rgba(255,255,255,0.5);
    font-size: 0.72rem;
    font-weight: 500;
}

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

.nav-section-label {
    color: rgba(255,255,255,0.35);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 14px 20px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.07);
    color: white;
    border-left-color: var(--admin-light);
}

.sidebar-link.active {
    background: rgba(82,183,136,0.15);
    color: white;
    border-left-color: var(--admin-light);
}

.sidebar-link .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    color: var(--admin-light);
}

.sidebar-link.active .nav-icon { color: var(--admin-light); }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    background: var(--admin-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-user-name { color: white; font-size: 0.85rem; font-weight: 600; display: block; }
.sidebar-user-role { color: rgba(255,255,255,0.5); font-size: 0.72rem; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ===== MAIN CONTENT ===== */
.admin-main {
    margin-left: var(--admin-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== TOPBAR ===== */
.admin-topbar {
    height: var(--admin-topbar-height);
    background: white;
    border-bottom: 1px solid #e8eff4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}

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

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #666;
    cursor: pointer;
    padding: 4px;
}

.page-heading { font-size: 1rem; font-weight: 700; color: var(--admin-dark); margin: 0; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-btn {
    background: none;
    border: 1px solid #e8eff4;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.topbar-btn:hover { background: #f5f7fa; color: var(--admin-primary); border-color: var(--admin-primary); }

.btn-logout { color: #dc3545 !important; }
.btn-logout:hover { background: #fff5f5 !important; border-color: #dc3545 !important; }

/* ===== CONTENT AREA ===== */
.admin-content { flex: 1; padding: 28px 24px; }

/* ===== STAT CARDS ===== */
.stat-card {
    background: white;
    border-radius: var(--admin-radius);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--admin-shadow);
    border: 1px solid #eef2f5;
    transition: all 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.green { background: #e8f8f0; color: #2D6A4F; }
.stat-icon.blue { background: #e3f2fd; color: #1976d2; }
.stat-icon.orange { background: #fff3e0; color: #f57c00; }
.stat-icon.red { background: #fce4ec; color: #c62828; }
.stat-icon.purple { background: #ede7f6; color: #6a1b9a; }
.stat-icon.teal { background: #e0f7fa; color: #00695c; }

.stat-number { font-size: 1.8rem; font-weight: 800; color: var(--admin-dark); line-height: 1; }
.stat-label { font-size: 0.82rem; color: #8a9ab0; font-weight: 500; margin-top: 4px; }

/* ===== CARDS ===== */
.admin-card {
    background: white;
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    border: 1px solid #eef2f5;
}

.admin-card-header {
    padding: 18px 22px;
    border-bottom: 1px solid #f0f4f8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--admin-dark);
    margin: 0;
}

.admin-card-body { padding: 22px; }

/* ===== TABLES ===== */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

.admin-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #8a9ab0;
    border-bottom: 2px solid #eef2f5;
    white-space: nowrap;
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f4f8;
    vertical-align: middle;
    color: #374151;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafbfd; }

/* ===== BADGES ===== */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active { background: #e8f8f0; color: #1a7a47; }
.badge-inactive { background: #fce4ec; color: #c62828; }
.badge-published { background: #e8f8f0; color: #1a7a47; }
.badge-draft { background: #fff3e0; color: #e65100; }
.badge-developer { background: #ede7f6; color: #6a1b9a; }
.badge-admin { background: #e3f2fd; color: #1976d2; }

/* ===== BUTTONS ===== */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit { background: #e3f2fd; color: #1976d2; border-color: #bbdefb; }
.btn-edit:hover { background: #1976d2; color: white; }

.btn-delete { background: #fce4ec; color: #c62828; border-color: #f8bbd9; }
.btn-delete:hover { background: #c62828; color: white; }

.btn-view { background: #e8f8f0; color: #1a7a47; border-color: #b2dfdb; }
.btn-view:hover { background: #1a7a47; color: white; }

.btn-toggle { background: #fff3e0; color: #e65100; border-color: #ffe0b2; }
.btn-toggle:hover { background: #e65100; color: white; }

/* ===== FORMS ===== */
.admin-form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    display: block;
}

.admin-form-label .required { color: #dc3545; }

.form-control, .form-select {
    border: 1px solid #d1d9e0;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 0.875rem;
    font-family: var(--admin-font);
    transition: all 0.2s;
    color: #374151;
}

.form-control:focus, .form-select:focus {
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(45,106,79,0.1);
    outline: none;
}

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

.form-help { font-size: 0.78rem; color: #8a9ab0; margin-top: 4px; }

/* ===== ADMIN BUTTONS ===== */
.btn {
    font-family: var(--admin-font);
    font-weight: 600;
    border-radius: 8px;
    padding: 0.55rem 1.4rem;
    transition: all 0.2s;
    font-size: 0.875rem;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary { background: var(--admin-primary); border-color: var(--admin-primary); color: white; }
.btn-primary:hover { background: var(--admin-dark); border-color: var(--admin-dark); color: white; }

.btn-success { background: #16a34a; border-color: #16a34a; color: white; }
.btn-success:hover { background: #15803d; border-color: #15803d; color: white; }

.btn-danger { background: #dc2626; border-color: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: white; }

.btn-secondary { background: #6b7280; border-color: #6b7280; color: white; }
.btn-secondary:hover { background: #4b5563; border-color: #4b5563; color: white; }

.btn-outline-primary { background: transparent; border-color: var(--admin-primary); color: var(--admin-primary); }
.btn-outline-primary:hover { background: var(--admin-primary); color: white; }

.btn-outline-secondary { background: transparent; border-color: #d1d9e0; color: #6b7280; }
.btn-outline-secondary:hover { background: #f5f7fa; color: #374151; }

.btn-sm { padding: 0.35rem 0.9rem; font-size: 0.8rem; }

/* ===== IMG PREVIEW ===== */
.img-preview-box {
    width: 100%;
    max-width: 200px;
    height: 150px;
    border: 2px dashed #d1d9e0;
    border-radius: var(--admin-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8fafc;
    margin-top: 10px;
}

.img-preview-box img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-box .placeholder { color: #b0b8c4; text-align: center; font-size: 0.8rem; }

/* ===== SORTABLE ===== */
.sortable-handle { cursor: grab; color: #b0b8c4; }
.sortable-handle:active { cursor: grabbing; }

/* ===== ALERTS ===== */
.alert {
    border-radius: var(--admin-radius);
    padding: 12px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #d97706; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #2563eb; }

/* ===== LOGIN PAGE ===== */
.admin-login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1B4332 0%, #2D6A4F 50%, #52B788 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #2D6A4F, #52B788);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin: 0 auto 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .admin-main { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .sidebar-overlay { display: block; }
    .sidebar-overlay.show { display: block; }
    .admin-content { padding: 20px 16px; }
}

@media (max-width: 575.98px) {
    .admin-content { padding: 16px 12px; }
    .admin-topbar { padding: 0 16px; }
    .admin-card-header { flex-direction: column; align-items: flex-start; }
    .login-card { padding: 30px 24px; }
}

/* ===== MISC ===== */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.thumb-sm {
    width: 50px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
}

.star-rating { color: #fbbf24; }

.divider-vertical { width: 1px; height: 24px; background: #e8eff4; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #8a9ab0;
}

.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }

/* Drag sort visual */
.drag-row { cursor: grab; }
.drag-row.dragging { opacity: 0.5; background: #f0fdf4; }

/* ===== UPLOAD AREA ===== */
.upload-area {
    border: 2px dashed #b7ddc8;
    border-radius: 14px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 60% 40%, rgba(82,183,136,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.upload-area:hover,
.upload-area:focus-within {
    border-color: var(--primary);
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(45,106,79,0.12);
}

.upload-area:active {
    transform: translateY(0);
}

.upload-area .upload-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 14px rgba(45,106,79,0.25);
}

.upload-area .upload-icon i {
    font-size: 1.6rem;
    color: #fff;
}

/* Fallback for inline <i> used in existing pages */
.upload-area > i {
    font-size: 2.2rem;
    color: var(--primary);
    display: block;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 4px rgba(45,106,79,0.2));
}

.upload-area p {
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.upload-area small {
    color: #6b7280;
    font-size: 0.8rem;
    line-height: 1.5;
}

.upload-area .upload-badge {
    display: inline-flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.upload-area .upload-badge span {
    background: rgba(45,106,79,0.1);
    color: var(--primary-dark);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(45,106,79,0.15);
}

/* Drag over state */
.upload-area.drag-over {
    border-color: var(--primary);
    background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
    transform: scale(1.01);
}

/* Image preview container */
.img-preview-wrap {
    position: relative;
    display: inline-block;
    margin-top: 16px;
}

.img-preview-wrap .img-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 26px;
    height: 26px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform .2s;
}

.img-preview-wrap .img-preview-remove:hover { transform: scale(1.15); }

