/**
 * BEF Panel - Main Styles
 * Modern Admin Panel UI
 */

:root {
    /* Colors */
    --primary: #ff6a20;
    --primary-hover: #e65a10;
    --primary-light: rgba(255, 106, 32, 0.1);
    --secondary: #64748b;
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --info: #0ea5e9;
    --info-light: rgba(14, 165, 233, 0.1);
    
    /* Dark Theme */
    --bg-dark: #1d1d1d;
    --bg-darker: #1d1d1d;
    --bg-card: #100e0d;
    --bg-card-hover: #262626;
    --border-color: rgba(255, 255, 255, 0.05);
    --text-primary: #fafaf9;
    --text-secondary: #d6d3d1;
    --text-muted: #a8a29e;
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    
    /* Header */
    --header-height: 64px;
    
    /* Spacing */
    --content-padding: 24px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.25;
}

small, .small {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

p {
    margin-bottom: 1rem;
}

.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-white { color: #ffffff !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }

.table thead th {
    color: var(--text-secondary) !important;
    font-weight: 600;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==================== */
/* LAYOUT */
/* ==================== */
.panel-wrapper {
    display: flex;
    min-height: 100vh;
}

.panel-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

.panel-content {
    flex: 1;
    padding: var(--content-padding);
    padding-top: calc(var(--header-height) + var(--content-padding));
}

/* ==================== */
/* SIDEBAR */
/* ==================== */
.panel-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-darker);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo img {
    max-height: 36px;
    width: auto;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav .nav-item {
    margin-bottom: 4px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.sidebar-nav .nav-link i {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--primary) 0%, #ff8e51 100%);
    color: white;
}

.sidebar-nav .nav-link .bi-chevron-down {
    font-size: 0.75rem;
    transition: transform var(--transition-fast);
}

.sidebar-nav .nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

/* Submenu */
.sidebar-nav .sub-menu {
    padding-left: 36px;
    margin-top: 4px;
}

.sidebar-nav .sub-menu .nav-link {
    padding: 8px 14px;
    font-size: 0.875rem;
}

/* Nav Divider */
.nav-divider {
    padding: 16px 14px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8e51 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* ==================== */
/* HEADER */
/* ==================== */
.panel-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: rgba(12, 10, 9, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--content-padding);
    z-index: 100;
    transition: left var(--transition-normal);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Breadcrumb */
.breadcrumb {
    background: none;
    padding: 0;
    font-size: 0.875rem;
}

.breadcrumb-item a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--primary);
}

.breadcrumb-item.active {
    color: var(--text-primary);
}

.breadcrumb-item + .breadcrumb-item::before {
    color: var(--text-muted);
}

/* Header Buttons */
.btn-ghost {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-ghost i {
    font-size: 1.125rem;
}

/* Header Selector */
.header-selector .dropdown-menu {
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
}

/* Notifications */
.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.notifications-dropdown {
    width: 360px;
    padding: 0;
}

.notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.notifications-header h6 {
    margin: 0;
    font-weight: 600;
}

.mark-all-read {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
}

.notifications-body {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.notification-item:hover {
    background: var(--bg-card-hover);
}

.notification-item.unread {
    background: var(--primary-light);
}

.notification-empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
}

.notification-empty i {
    font-size: 2rem;
    margin-bottom: 8px;
}

/* User Avatar Small */
.user-avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8e51 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    overflow: hidden;
}

.user-avatar-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name-header {
    font-weight: 500;
}

/* User Dropdown */
.header-user .dropdown-menu {
    min-width: 200px;
}

.header-user .dropdown-header {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
}

.header-user .dropdown-header strong {
    font-size: 0.875rem;
}

.header-user .dropdown-header small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ==================== */
/* DROPDOWNS */
/* ==================== */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
}

.dropdown-item {
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.dropdown-item:hover, .dropdown-item:focus {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.dropdown-item.text-danger:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.dropdown-header {
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px 4px;
}

.dropdown-divider {
    border-color: var(--border-color);
    margin: 8px 0;
}

/* ==================== */
/* CARDS */
/* ==================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.card-header {
    background: none;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
}

.card-header .card-title,
.card-header h1, .card-header h2, .card-header h3, 
.card-header h4, .card-header h5, .card-header h6 {
    color: #fafaf9 !important;
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
    opacity: 1 !important;
    display: block !important;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: none;
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 16px;
}

.stat-card .stat-icon.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card .stat-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.stat-card .stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card .stat-icon.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ==================== */
/* BUTTONS */
/* ==================== */
.btn {
    font-weight: 500;
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #ff8e51 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #e65a10 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 106, 32, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-success {
    background: var(--success);
    border: none;
}

.btn-danger {
    background: var(--danger);
    border: none;
}

.btn-warning {
    background: var(--warning);
    border: none;
    color: #000;
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

/* ==================== */
/* FORMS */
/* ==================== */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.form-control, .form-select {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 10px 14px;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    background: var(--bg-dark);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 106, 32, 0.15);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.invalid-feedback {
    color: var(--danger);
    font-size: 0.8125rem;
}

.form-text {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Form Check */
.form-check-input {
    background-color: var(--bg-dark);
    border-color: var(--border-color);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 106, 32, 0.15);
    border-color: var(--primary);
}

/* Input Group */
.input-group-text {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

/* ==================== */
/* TABLES */
/* ==================== */
.table {
    color: var(--text-primary);
    margin: 0;
}

.table > :not(caption) > * > * {
    background: transparent;
    border-color: var(--border-color);
    padding: 12px 16px;
}

.table > thead > tr > th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom-width: 1px;
}

.table > tbody > tr:hover {
    background: var(--bg-card-hover);
}

.table-responsive {
    border-radius: var(--radius-md);
}

/* ==================== */
/* BADGES */
/* ==================== */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
}

.badge.bg-primary {
    background: var(--primary-light) !important;
    color: var(--primary);
}

.badge.bg-success {
    background: var(--success-light) !important;
    color: var(--success);
}

.badge.bg-warning {
    background: var(--warning-light) !important;
    color: var(--warning);
}

.badge.bg-danger {
    background: var(--danger-light) !important;
    color: var(--danger);
}

.badge.bg-info {
    background: var(--info-light) !important;
    color: var(--info);
}

.badge.bg-secondary {
    background: rgba(100, 116, 139, 0.2) !important;
    color: var(--secondary);
}

/* ==================== */
/* ALERTS */
/* ==================== */
.alert {
    border-radius: var(--radius-md);
    border: none;
    padding: 12px 16px;
    font-size: 0.875rem;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.alert-info {
    background: var(--info-light);
    color: var(--info);
}

.alert .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.5;
}

/* ==================== */
/* MODALS */
/* ==================== */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.modal-header {
    border-bottom-color: var(--border-color);
    padding: 20px 24px;
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    border-top-color: var(--border-color);
    padding: 16px 24px;
}

.btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 0.8;
}

/* ==================== */
/* PAGE HEADER */
/* ==================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* ==================== */
/* RESPONSIVE */
/* ==================== */
@media (max-width: 991.98px) {
    .panel-sidebar {
        transform: translateX(-100%);
    }
    
    .panel-sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .panel-main {
        margin-left: 0;
    }
    
    .panel-header {
        left: 0;
    }
}

@media (max-width: 767.98px) {
    .panel-content {
        padding: 16px;
        padding-top: calc(var(--header-height) + 16px);
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .notifications-dropdown {
        width: 100vw;
        max-width: 360px;
    }
}

/* ==================== */
/* UTILITIES */
/* ==================== */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.bg-primary-light { background: var(--primary-light) !important; }
.bg-success-light { background: var(--success-light) !important; }
.bg-danger-light { background: var(--danger-light) !important; }
.bg-warning-light { background: var(--warning-light) !important; }

.border-primary { border-color: var(--primary) !important; }
.border-success { border-color: var(--success) !important; }
.border-danger { border-color: var(--danger) !important; }

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border {
    color: var(--primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}
