/* =============================================
   BlzCoreLab - Professional Dashboard Styles
   Bootstrap 5 Based Business Dashboard
   ============================================= */

/* CSS Variables */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --top-navbar-height: 70px;
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-bg: #1a1d29;
    --sidebar-hover: #252a3a;
    --content-bg: #f5f6fa;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-muted: #6c757d;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--content-bg);
    color: var(--dark-color);
    overflow-x: hidden;
}

/* =============================================
   Dashboard Layout
   ============================================= */

.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
    overflow: hidden;
}

.sidebar.sidebar-collapsed {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--top-navbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    white-space: nowrap;
}

.brand-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.brand-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    display: block;
    padding: 0 1.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0.5rem;
}

.sidebar-nav .nav {
    padding: 0 0.75rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    transition: var(--transition);
    position: relative;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    background-color: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, var(--primary-color), transparent);
    border-left: 3px solid var(--primary-color);
}

.nav-icon {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Tooltip for collapsed sidebar */
.tooltip-text {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--dark-color);
    color: #fff;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    margin-left: 0.5rem;
    z-index: 1001;
}

.tooltip-text::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: transparent var(--dark-color) transparent transparent;
}

.sidebar-collapsed .nav-link:hover .tooltip-text.show-tooltip {
    opacity: 1;
    visibility: visible;
}

.nav-link-form {
    margin: 0;
    padding: 0;
}

.nav-link-btn {
    width: 100%;
    background: transparent;
    border: none;
    cursor: pointer;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.main-content.content-expanded {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Navbar */
.top-navbar {
    height: var(--top-navbar-height);
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 999;
}

.mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-color);
    cursor: pointer;
    border-radius: 0.375rem;
    margin-right: 1rem;
}

.mobile-toggle:hover {
    background-color: var(--light-color);
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item a {
    color: var(--text-muted);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--dark-color);
    font-weight: 500;
}

.top-navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    position: relative;
    width: 250px;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    padding-left: 2.5rem;
    background-color: var(--content-bg);
    border: 1px solid transparent;
    border-radius: 2rem;
}

.search-box input:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.nav-icons {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
}

.icon-btn:hover {
    background-color: var(--content-bg);
    color: var(--dark-color);
}

.icon-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.65rem;
    padding: 0.2rem 0.4rem;
    background-color: var(--danger-color);
}

/* User Menu */
.user-menu {
    margin-left: 0.5rem;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    border: none;
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: var(--transition);
}

.user-menu-btn:hover {
    background-color: var(--content-bg);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), #6610f2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
}

.user-info {
    text-align: left;
    line-height: 1.2;
}

.user-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--dark-color);
}

.user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: 0.75rem;
    padding: 0.5rem 0;
    min-width: 200px;
}

.dropdown-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--dark-color);
    padding: 0.75rem 1rem;
}

.dropdown-item {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: var(--dark-color);
    display: flex;
    align-items: center;
}

.dropdown-item:hover {
    background-color: var(--content-bg);
}

.dropdown-item.text-danger {
    color: var(--danger-color) !important;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 1.5rem;
}

/* =============================================
   Dashboard Components
   ============================================= */

.dashboard-header {
    margin-bottom: 1.5rem;
}

.dashboard-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.dashboard-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* Dashboard Cards */
.dashboard-card {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    background-color: transparent;
    border-top: 1px solid var(--border-color);
}

/* Stat Cards */
.stat-card {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-card-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.stat-card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.stat-change {
    font-weight: 600;
}

.stat-change.positive {
    color: var(--success-color);
}

.stat-change.negative {
    color: var(--danger-color);
}

.stat-period {
    color: var(--text-muted);
}

/* Activity List */
.activity-list {
    padding: 0.5rem 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 0.9rem;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Chart Placeholder */
.chart-placeholder {
    height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 160px;
    gap: 1rem;
    padding-bottom: 1rem;
}

.chart-bar {
    flex: 1;
    background: linear-gradient(180deg, var(--primary-color), #0a58ca);
    border-radius: 0.375rem 0.375rem 0 0;
    opacity: 0.6;
    transition: var(--transition);
    min-width: 30px;
}

.chart-bar:hover,
.chart-bar.active {
    opacity: 1;
}

.chart-labels {
    display: flex;
    justify-content: space-around;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.chart-labels span {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex: 1;
    text-align: center;
}

/* Tables */
.table {
    font-size: 0.9rem;
}

.table thead th {
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 1.25rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    color: var(--dark-color);
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.02);
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Footer */
.dashboard-footer {
    padding: 1.25rem 1.5rem;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.dashboard-footer a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 1.5rem;
}

.dashboard-footer a:hover {
    color: var(--primary-color);
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* =============================================
   Profile Page Styles
   ============================================= */

.profile-avatar-large {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--primary-color), #6610f2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 3rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.contact-item:last-child {
    border-bottom: none;
}

.contact-item i {
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(13, 110, 253, 0.1);
    border-radius: 0.5rem;
}

.preference-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.preference-item:last-child {
    border-bottom: none;
}

.preference-item h6 {
    font-weight: 600;
}

/* =============================================
   Reports Page Styles
   ============================================= */

.report-stat-card {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
}

.report-stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
}

.chart-container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.line-chart {
    flex: 1;
    height: 200px;
}

.chart-svg {
    width: 100%;
    height: 100%;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.donut-chart {
    width: 200px;
    height: 200px;
}

.donut-svg {
    width: 100%;
    height: 100%;
}

.donut-value {
    font-size: 24px;
    font-weight: 700;
    fill: var(--dark-color);
}

.donut-label {
    font-size: 12px;
    fill: var(--text-muted);
}

.category-list {
    flex: 1;
}

.category-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
}

.category-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.75rem;
}

.category-name {
    flex: 1;
    color: var(--dark-color);
}

.category-value {
    font-weight: 600;
    color: var(--dark-color);
}

/* Mobile Sidebar Styles */
.sidebar.mobile-open {
    transform: translateX(0) !important;
}

.sidebar-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: var(--transition);
}

.sidebar-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* =============================================
   Responsive Styles
   ============================================= */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
        transition: transform 0.3s ease;
    }

    .sidebar.sidebar-collapsed {
        width: var(--sidebar-width) !important;
        min-width: var(--sidebar-width) !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .main-content.content-expanded {
        margin-left: 0 !important;
    }

    .search-box {
        display: none;
    }

    .dashboard-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    .content-area {
        padding: 1rem;
    }

    .dashboard-header .row {
        flex-direction: column;
        gap: 1rem;
    }

    .dashboard-header .col-auto {
        width: 100%;
    }

    .dashboard-header .btn {
        width: 100%;
    }

    .stat-card-body {
        flex-direction: column;
        text-align: center;
    }

    .chart-container {
        flex-direction: column;
    }

    .dashboard-footer .row {
        text-align: center;
    }

    .dashboard-footer .text-md-end {
        text-align: center !important;
        margin-top: 0.5rem;
    }

    .dashboard-footer a {
        margin: 0 0.75rem;
    }
}

/* =============================================
   Utility Classes
   ============================================= */

.auth-links {
    display: flex;
    align-items: center;
}

/* Form Enhancements */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* Button Enhancements */
.btn {
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #0a58ca);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0b5ed7, #094aba);
}

/* Pagination */
.pagination .page-link {
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-card {
    animation: fadeIn 0.3s ease-out;
}

/* Loading Spinner */
.spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Print: hide sidebar/navbar, reset layout */
@media print {
    .sidebar,
    .top-navbar,
    .mobile-toggle {
        display: none !important;
    }
    .dashboard-wrapper {
        display: block !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .content-area {
        padding: 0 !important;
    }
}
