/**
 * Blocks Admin Dashboard - Custom Styles
 * Built on Bootstrap 5
 */

/* ============================================
   CSS Variables / Theme Colors
   ============================================ */
:root {
    --bs-primary: #696cff;
    --bs-primary-rgb: 105, 108, 255;
    --bs-success: #71dd37;
    --bs-warning: #ffab00;
    --bs-danger: #ff3e1d;
    --bs-info: #03c3ec;
    --bs-secondary: #8592a3;
    
    --sidebar-width: 260px;
    --header-height: 64px;
    --footer-height: 56px;
}

/* ============================================
   Base Styles
   ============================================ */
body {
    font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f9;
    color: #566a7f;
    min-height: 100vh;
}

a {
    color: var(--bs-primary);
    text-decoration: none;
}

a:hover {
    color: #5f61e6;
}

/* ============================================
   Layout Structure
   ============================================ */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

.layout-container {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
}

.layout-page {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 1.5rem;
    padding-top: calc(var(--header-height) + 1.5rem);
}

.container-xxl {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   Sidebar / Menu
   ============================================ */
.layout-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #fff;
    border-right: 1px solid #e7e7e8;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.app-brand {
    display: flex;
    align-items: center;
    height: var(--header-height);
    padding: 0 1.5rem;
    border-bottom: 1px solid #e7e7e8;
}

.app-brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #566a7f;
}

.app-brand-logo img {
    height: 32px;
    width: auto;
}

.menu-inner {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex: 1;
}

.menu-header {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #a1acb8;
}

.menu-item {
    margin: 2px 0;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #566a7f;
    transition: all 0.2s ease;
    border-radius: 0;
    margin: 0 0.5rem;
    border-radius: 6px;
}

.menu-link:hover {
    background-color: rgba(105, 108, 255, 0.08);
    color: var(--bs-primary);
}

.menu-item.active > .menu-link {
    background-color: rgba(105, 108, 255, 0.16);
    color: var(--bs-primary);
    font-weight: 500;
}

.menu-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    width: 24px;
    text-align: center;
}

/* ============================================
   Navbar / Header
   ============================================ */
.layout-navbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e7e7e8;
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.navbar-nav {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-nav.ms-auto {
    margin-left: auto;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: #566a7f;
}

.nav-link:hover {
    color: var(--bs-primary);
}

/* ============================================
   Footer
   ============================================ */
.content-footer {
    padding: 1rem 1.5rem;
    background: #fff;
    border-top: 1px solid #e7e7e8;
    margin-top: auto;
}

.footer-link {
    color: #566a7f;
}

.footer-link:hover {
    color: var(--bs-primary);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: #fff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(67, 89, 113, 0.12);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1.25rem 1.5rem;
    background: transparent;
    border-bottom: 1px solid #e7e7e8;
}

.card-body {
    padding: 1.5rem;
}

.stat-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(67, 89, 113, 0.2);
}

/* ============================================
   Avatars
   ============================================ */
.avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-initial {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 600;
}

/* ============================================
   Labels / Badges
   ============================================ */
.bg-label-primary {
    background-color: rgba(105, 108, 255, 0.16) !important;
    color: var(--bs-primary) !important;
}

.bg-label-success {
    background-color: rgba(113, 221, 55, 0.16) !important;
    color: var(--bs-success) !important;
}

.bg-label-warning {
    background-color: rgba(255, 171, 0, 0.16) !important;
    color: var(--bs-warning) !important;
}

.bg-label-danger {
    background-color: rgba(255, 62, 29, 0.16) !important;
    color: var(--bs-danger) !important;
}

.bg-label-info {
    background-color: rgba(3, 195, 236, 0.16) !important;
    color: var(--bs-info) !important;
}

.bg-label-secondary {
    background-color: rgba(133, 146, 163, 0.16) !important;
    color: var(--bs-secondary) !important;
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover {
    background-color: #5f61e6;
    border-color: #5f61e6;
}

.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-outline-primary:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* ============================================
   Tables
   ============================================ */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: #566a7f;
    border-bottom-width: 1px;
}

.table-hover tbody tr:hover {
    background-color: rgba(105, 108, 255, 0.04);
}

/* DataTables Overrides */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #d9dee3;
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #d9dee3;
    border-radius: 6px;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: #fff !important;
    border-radius: 6px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(105, 108, 255, 0.16) !important;
    border-color: transparent !important;
    color: var(--bs-primary) !important;
}

/* ============================================
   Activity Feed
   ============================================ */
.activity-feed {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    padding: 12px 0;
    border-bottom: 1px solid #e7e7e8;
}

.activity-item:last-child {
    border-bottom: none;
}

/* ============================================
   Impersonation Banner
   ============================================ */
.impersonation-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ff9f43 0%, #ffab00 100%);
    color: #fff;
    text-align: center;
    padding: 10px 15px;
    z-index: 10000;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(255, 159, 67, 0.4);
}

.impersonation-banner a {
    color: #fff;
    text-decoration: underline;
    margin-left: 10px;
}

body:has(.impersonation-banner) .layout-menu,
body:has(.impersonation-banner) .layout-navbar {
    top: 44px;
}

body:has(.impersonation-banner) .layout-page {
    padding-top: 44px;
}

/* ============================================
   Admin Badge
   ============================================ */
.admin-badge {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 9999;
    background: linear-gradient(135deg, #696cff 0%, #5f61e6 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(105, 108, 255, 0.4);
}

/* ============================================
   Trends
   ============================================ */
.trend-up { color: var(--bs-success); }
.trend-down { color: var(--bs-danger); }

/* ============================================
   Dropdown Menus
   ============================================ */
.dropdown-menu {
    border: none;
    box-shadow: 0 4px 25px rgba(67, 89, 113, 0.15);
    border-radius: 8px;
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    color: #566a7f;
}

.dropdown-item:hover {
    background-color: rgba(105, 108, 255, 0.08);
    color: var(--bs-primary);
}

.dropdown-divider {
    margin: 0.5rem 0;
}

/* ============================================
   Forms
   ============================================ */
.form-control, .form-select {
    border-color: #d9dee3;
    border-radius: 6px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(105, 108, 255, 0.25);
}

.form-label {
    font-weight: 500;
    color: #566a7f;
    margin-bottom: 0.375rem;
}

/* ============================================
   Modals
   ============================================ */
.modal-content {
    border: none;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(67, 89, 113, 0.2);
}

.modal-header {
    border-bottom-color: #e7e7e8;
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top-color: #e7e7e8;
    padding: 1rem 1.5rem;
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 20px;
    margin-bottom: 8px;
}

.skeleton-text-sm {
    height: 14px;
    width: 60%;
}

.skeleton-title {
    height: 32px;
    width: 80px;
}

.skeleton-chart {
    height: 350px;
}

/* ============================================
   Utilities
   ============================================ */
.fw-semibold {
    font-weight: 600 !important;
}

.text-primary {
    color: var(--bs-primary) !important;
}

.bg-primary {
    background-color: var(--bs-primary) !important;
}

.rounded-circle {
    border-radius: 50% !important;
}

/* Small text helpers */
.small, small {
    font-size: 0.8125rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1199.98px) {
    .layout-menu {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .layout-menu.show {
        transform: translateX(0);
    }
    
    .layout-page {
        margin-left: 0;
    }
    
    .layout-navbar {
        left: 0;
    }
}

@media (max-width: 767.98px) {
    .content-wrapper {
        padding: 1rem;
        padding-top: calc(var(--header-height) + 1rem);
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* ============================================
   Login Page Specific
   ============================================ */
.authentication-wrapper {
    display: flex;
    flex-basis: 100%;
    min-height: 100vh;
    width: 100%;
}

.authentication-inner {
    width: 100%;
    max-width: 400px;
    margin: auto;
    padding: 2rem;
}

.authentication-wrapper .card {
    box-shadow: 0 4px 25px rgba(67, 89, 113, 0.15);
}

.app-brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bs-primary);
}
