/**
 * CleanOps Pro - Main Stylesheet
 * Built on Bootstrap 5 defaults
 */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topnav-height: 60px;
    --footer-height: 50px;
}

/* Base Layout */
html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    background-color: #f5f7fb;
}

.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    width: 100%;
    transition: margin-left 0.3s ease;
}

.content {
    flex: 1;
    padding: 1.5rem;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: #222e3c;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1040;
    overflow-y: auto;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1.15rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: rgba(0,0,0,.1);
}

.sidebar-brand:hover {
    color: #fff;
}

.sidebar-logo {
    max-height: 40px;
    max-width: 180px;
}

.sidebar-brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-header {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8a98ac;
}

.sidebar-item {
    position: relative;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: #8a98ac;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-link:hover,
.sidebar-item.active > .sidebar-link {
    color: #fff;
    background: rgba(255,255,255,.05);
}

.sidebar-link i {
    font-size: 1.1rem;
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Sidebar Dropdown */
.sidebar-link[data-bs-toggle="collapse"] {
    position: relative;
}

.sidebar-link[data-bs-toggle="collapse"] span {
    flex: 1;
}

.sidebar-chevron {
    font-size: 0.875rem;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.sidebar-link[aria-expanded="true"] .sidebar-chevron {
    transform: rotate(180deg);
}

.sidebar-dropdown {
    padding: 0;
    margin: 0;
    list-style: none;
    background: rgba(0,0,0,.15);
}

.sidebar-dropdown .sidebar-item {
    border-left: 2px solid transparent;
}

.sidebar-dropdown .sidebar-item.active {
    border-left-color: #0d6efd;
}

.sidebar-dropdown .sidebar-link {
    padding: 0.6rem 1.5rem 0.6rem 3rem;
    font-size: 0.875rem;
}

.sidebar-dropdown .sidebar-link i {
    font-size: 0.95rem;
    width: 18px;
}

.sidebar-dropdown .sidebar-link:hover,
.sidebar-dropdown .sidebar-item.active .sidebar-link {
    color: #fff;
    background: rgba(255,255,255,.03);
}

/* Sidebar Collapsed State */
.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar-brand-text,
.sidebar-collapsed .sidebar-link span,
.sidebar-collapsed .sidebar-header {
    display: none;
}

.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar-collapsed .sidebar-link i {
    margin-right: 0;
}

.sidebar-collapsed .main {
    margin-left: var(--sidebar-collapsed-width);
}

/* Main with sidebar */
.main {
    margin-left: var(--sidebar-width);
}

/* Top Navigation */
.navbar-bg {
    background: #fff;
    box-shadow: 0 0 2rem 0 rgba(33,37,41,.1);
    padding: 0.75rem 1.5rem;
}

.sidebar-toggle {
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    color: #495057;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: #f5f7fb;
    color: #222;
}

.sidebar-toggle i {
    font-size: 1.25rem;
}

.navbar-nav .nav-link,
.navbar-nav .nav-icon {
    text-decoration: none;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-icon:hover {
    text-decoration: none;
}

.navbar-nav .nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    color: #495057;
    font-size: 1.1rem;
    position: relative;
}

.navbar-nav .nav-icon:hover {
    color: #222;
}

.navbar-nav .indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: #dc3545;
    border-radius: 50%;
}

.dropdown-menu-header {
    padding: 0.75rem 1rem;
    font-weight: 600;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.dropdown-menu-footer {
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

.dropdown-menu-lg {
    min-width: 280px;
}

/* Footer */
.footer {
    background: #fff;
    padding: 1rem 1.5rem;
    border-top: 1px solid #dee2e6;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 0 2rem 0 rgba(33,37,41,.05);
    margin-bottom: 1.5rem;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,.05);
    padding: 1rem 1.25rem;
}

.card-title {
    margin-bottom: 0;
    font-weight: 600;
}

/* Stats Cards */
.stat-card {
    border-radius: 0.5rem;
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.875rem;
}

/* Avatar */
.avatar-initials {
    font-weight: 600;
    text-transform: uppercase;
}

/* Tables */
.table-hover tbody tr:hover {
    background-color: rgba(0,0,0,.02);
}

/* Forms */
.form-label {
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13,110,253,.15);
}

/* Buttons */
.btn {
    font-weight: 500;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Page Header */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.page-header .lead {
    color: #6c757d;
    font-size: 0.9375rem;
}

/* Status Badge */
.badge {
    font-weight: 500;
    padding: 0.4em 0.65em;
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
}

/* Select2 Customization */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
}

/* Dark Mode */
.dark-mode {
    background-color: #1a1d21;
    color: #e9ecef;
}

.dark-mode .card,
.dark-mode .navbar-bg,
.dark-mode .footer {
    background-color: #212529;
    color: #e9ecef;
}

.dark-mode .card-header {
    border-color: rgba(255,255,255,.1);
}

.dark-mode .table {
    color: #e9ecef;
}

.dark-mode .form-control,
.dark-mode .form-select {
    background-color: #2b3035;
    border-color: #495057;
    color: #e9ecef;
}

.dark-mode .dropdown-menu {
    background-color: #212529;
    border-color: #495057;
}

.dark-mode .dropdown-item {
    color: #e9ecef;
}

.dark-mode .dropdown-item:hover {
    background-color: #2b3035;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
    }

    .sidebar-collapsed .main {
        margin-left: 0;
    }
}

@media (max-width: 767.98px) {
    .content {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }
}

/* RTL Support */
[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] .main {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] .sidebar-collapsed .main {
    margin-right: var(--sidebar-collapsed-width);
}

[dir="rtl"] .sidebar-link i {
    margin-right: 0;
    margin-left: 0.75rem;
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .footer {
        display: none !important;
    }

    .main {
        margin-left: 0 !important;
    }

    .content {
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}
