/* ============================================
   Dashboard Styles - HookListener Inspired
   ============================================ */

/* ============================================
   CSS Variables - HookListener Color Palette
   ============================================ */
.btn-primary {
    --bs-btn-disabled-bg:#9E9E9E !important;
}
.btn-info {
    --bs-btn-bg: #addee8 !important;
}
.table {
    --bs-table-hover-bg: rgba(13, 110, 253, 0.08) !important;
}
.text-dark {
    color: rgb(101 178 255) !important;
}

:root {
    /* Primary - фиолетовый как в HookListener */
    --dp-primary: #009688;
    --dp-primary-hover: #009688;
    --dp-primary-light: #a78bfa;
    
    /* Secondary Colors */
    --dp-secondary: #475569;
    --dp-success: #059669;
    --dp-danger: #dc2626;
    --dp-warning: #d97706;
    --dp-info: #0891b2;
    --dp-dark: #0f172a;
    
    /* Background - светлая тема */
    --dp-body-bg: #f1f5f9;
    --dp-card-bg: #ffffff;
    --dp-sidebar-bg: #ffffff;
    --dp-menu-hover: #e2e8f0;
    --dp-menu-active: #cbd5e1;
    
    /* Text - более контрастные */
    --dp-text-primary: #000000;
    --dp-text-secondary: #1e293b;
    --dp-text-muted: #475569;
    --dp-text-white: #ffffff;
    
    /* Border */
    --dp-border-color: #cbd5e1;
    --dp-border-radius: 8px;
    
    /* Shadows */
    --dp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --dp-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
    --dp-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.18);
    
    /* Layout */
    --dp-sidebar-width: 260px;
    --dp-header-height: 70px;
}

/* Dark Theme - Modern and Pleasant */
[data-theme="dark"] {
    /* Backgrounds - современный тёмный с синим подтоном */
    --dp-body-bg: #0f172a;
    --dp-card-bg: #1e293b;
    --dp-sidebar-bg: #1e293b;
    --dp-menu-hover: #334155;
    --dp-menu-active: #475569;
    
    /* Text - высококонтрастные для тёмной темы */
    --dp-text-primary: #ffffff;
    --dp-text-secondary: #e2e8f0;
    --dp-text-muted: #94a3b8;
    
    /* Border */
    --dp-border-color: #334155;
    
    /* Shadows */
    --dp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --dp-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    --dp-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    
    /* Bootstrap overrides for dark theme */
    --bs-secondary: #e2e8f0;
    --bs-secondary-color: #e2e8f0;
    --bs-secondary-bg: #334155;
    
    /* Form elements */
    --dp-input-bg: #334155;
    --dp-input-border: #475569;
    --dp-input-text: #f1f5f9;
    --dp-input-placeholder: #64748b;
}

/* Dark theme form improvements */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--dp-input-bg);
    border-color: var(--dp-input-border);
    color: var(--dp-input-text);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #3d4f63;
    border-color: var(--dp-primary);
    color: var(--dp-input-text);
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--dp-input-placeholder);
}

[data-theme="dark"] .btn-close {
    filter: invert(1) brightness(0.9);
}

/* Dark theme for Bootstrap cards */
[data-theme="dark"] .card {
    background: var(--dp-card-bg) !important;
    border-color: var(--dp-border-color) !important;
}

[data-theme="dark"] .card-header {
    background: var(--dp-card-bg) !important;
    border-color: var(--dp-border-color) !important;
}

[data-theme="dark"] .card-footer {
    background: var(--dp-card-bg) !important;
    border-color: var(--dp-border-color) !important;
}

[data-theme="dark"] .card-body {
    background: var(--dp-card-bg) !important;
}

[data-theme="dark"] .stat-card {
    background: var(--dp-card-bg) !important;
    border-color: var(--dp-border-color) !important;
}

[data-theme="dark"] .table {
    color: var(--dp-text-primary);
}

[data-theme="dark"] .table > thead {
    background-color: var(--dp-menu-hover) !important;
}

[data-theme="dark"] .table > tbody > tr {
    background-color: var(--dp-card-bg);
}

[data-theme="dark"] .table > tbody > tr:hover {
    background-color: var(--dp-menu-hover) !important;
}

/* Override hardcoded light backgrounds from dashboardpack */
[data-theme="dark"] .admin-table thead th,
[data-theme="dark"] .admin-table thead tr {
    background-color: var(--dp-menu-hover) !important;
    color: var(--dp-text-secondary) !important;
}

[data-theme="dark"] .admin-table tbody td {
    background-color: var(--dp-card-bg);
    color: var(--dp-text-primary);
}

[data-theme="dark"] .sender-avatar {
    border-color: var(--dp-card-bg);
}

/* Main page widgets - ensure dark background and light text */
[data-theme="dark"] .stat-card-value,
[data-theme="dark"] .stat-card-label {
    color: var(--dp-text-primary) !important;
}

[data-theme="dark"] .stat-card-label {
    color: var(--dp-text-secondary) !important;
}

[data-theme="dark"] .stat-card-icon i {
    color: var(--dp-primary) !important;
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--dp-body-bg);
    min-height: 100vh;
    color: var(--dp-text-primary);
    font-size: 13px;
    line-height: 1.5;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth theme transitions */
.global-header,
.sidebar,
.mobile-header,
.mobile-footer,
.card,
.modal-content,
.dropdown-menu {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* ============================================
   Layout
   ============================================ */

/* Layout Header - wrapper for mobile-header + global-header */
.layout-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
}

/* Desktop header - fixed position */
@media (min-width: 992px) {
    .layout-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: var(--dp-header-height);
    }
    
    .global-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: var(--dp-header-height);
    }
    
    .mobile-header {
        display: none;
    }
    
    .app-container {
        padding-bottom: 0; /* No footer padding on desktop */
    }
}

/* Layout Footer - hidden on desktop by default */
.layout-footer {
    display: none;
}

.app-container {
    display: flex;
    min-height: 100vh;
    padding-top: var(--dp-header-height);
}

/* Login/Verify pages - remove header padding */
.app-container:has(.login-page) {
    padding-top: 0;
}

/* Sidebar */
.sidebar {
    width: var(--dp-sidebar-width);
    background: var(--dp-sidebar-bg);
    border-right: 1px solid var(--dp-border-color);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    box-shadow: var(--dp-shadow-sm);
    /* padding-top: 20px; */
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    height: var(--dp-header-height);
    display: flex;
    align-items: center;
    padding: 0 25px;
    border-bottom: 1px solid var(--dp-border-color);
    font-weight: 800;
    font-size: 20px;
    color: var(--dp-primary);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.sidebar-brand:hover {
   color: var(--dp-primary);
}

.sidebar-brand i {
    font-size: 26px;
    margin-right: 12px;
}

.sidebar-menu {
    padding: 20px 16px;
    flex: 1;
}

.sidebar-menu-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--dp-text-muted);
    padding: 24px 18px 12px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: var(--dp-text-secondary);
    text-decoration: none;
    border-radius: var(--dp-border-radius);
    margin-bottom: 2px;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 14px;
}

.sidebar-menu a:hover {
    background: var(--dp-menu-hover);
    color: var(--dp-primary);
}

.sidebar-menu a.active {
    background: var(--dp-menu-active);
    color: var(--dp-primary);
    font-weight: 700;
}

.sidebar-menu a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* ============================================
   Sidebar Footer
   ============================================ */
.sidebar-footer {
    padding: 16px;
    margin-top: auto;
}

.sidebar-footer-btn {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--dp-text-secondary);
    text-decoration: none;
    border-radius: var(--dp-border-radius);
    margin-bottom: 6px;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 13px;
}

.sidebar-footer-btn:last-child {
    margin-bottom: 0;
}

.sidebar-footer-btn:hover {
    background: var(--dp-menu-hover);
    color: var(--dp-primary);
}

.sidebar-footer-btn i {
    margin-right: 10px;
    width: 18px;
    text-align: center;
    font-size: 15px;
}

.sidebar-footer-btn-danger {
    color: var(--dp-danger);
}

.sidebar-footer-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--dp-danger);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--dp-sidebar-width);
    padding: 20px 25px;
    transition: margin-left 0.3s ease;
    width: calc(100% - var(--dp-sidebar-width));
}

/* Main Content without sidebar (login page) */
.main-content.no-sidebar {
    margin-left: 0;
    padding: 0;
    width: 100%;
}

/* ============================================
   Global Header with Search
   ============================================ */
.global-header {
    position: relative;
    height: var(--dp-header-height);
    background: var(--dp-card-bg);
    border-bottom: 1px solid var(--dp-border-color);
    display: flex;
    align-items: center;
    padding: 0 30px;
    gap: 20px;
    transition: left 0.3s ease;
}

/* Brand в header */
.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 18px;
    color: var(--dp-primary);
    text-decoration: none;
    flex-shrink: 0;
}

.header-brand:hover {
    color: var(--dp-primary);
}

.header-brand i {
    font-size: 22px;
}

.global-search {
    flex: 1;
    max-width: 500px;
    position: relative;
    margin-left: 65px;
}

.global-search input {
    width: 100%;
    padding: 10px 18px 10px 46px !important;
    border: 2px solid var(--dp-border-color);
    border-radius: var(--dp-border-radius);
    background: var(--dp-body-bg);
    color: var(--dp-text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.global-search input:focus {
    outline: none;
    border-color: var(--dp-primary);
    background: var(--dp-card-bg);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}

.global-search input::placeholder {
    color: var(--dp-text-muted);
}

.global-search .search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dp-text-muted);
    font-size: 16px;
    pointer-events: none;
}

.global-search .search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--dp-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    display: none;
}

.global-search .search-clear:hover {
    background: var(--dp-menu-hover);
    color: var(--dp-text-primary);
}

.global-search.has-value .search-clear {
    display: block;
}

.logs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    color: var(--dp-text-muted);
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   Header Actions (Notifications + User)
   ============================================ */
.header-actions {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   Header Notifications
   ============================================ */
.header-notifications-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--dp-text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s ease;
}

.header-notifications-btn:hover {
    background: var(--dp-menu-hover);
    color: var(--dp-primary);
}

.notifications-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--dp-danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

/* Notifications Dropdown */
.notifications-dropdown {
    width: 360px;
    max-width: calc(100vw - 40px);
    padding: 0;
    border: 1px solid var(--dp-border-color);
    border-radius: var(--dp-border-radius);
    box-shadow: var(--dp-shadow-lg);
    background: var(--dp-card-bg);
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--dp-border-color);
}

.notifications-header h6 {
    margin: 0;
    font-weight: 700;
    color: var(--dp-text-primary);
    font-size: 15px;
}

.notifications-header .btn-link {
    font-size: 12px;
    padding: 0;
    color: var(--dp-primary);
    text-decoration: none;
}

.notifications-header .btn-link:hover {
    text-decoration: underline;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    padding: 16px 20px;
    border-bottom: 1px solid var(--dp-border-color);
    cursor: pointer;
    transition: background 0.2s ease;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--dp-menu-hover);
}

.notification-item.unread {
    background: rgba(124, 58, 237, 0.05);
}

.notification-item.unread:hover {
    background: rgba(124, 58, 237, 0.1);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.1);
    color: var(--dp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    margin-right: 12px;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    color: var(--dp-text-primary);
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.4;
}

.notification-message {
    color: var(--dp-text-secondary);
    font-size: 13px;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    /* -webkit-line-clamp: 2; */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 11px;
    color: var(--dp-text-muted);
}

.notifications-loading,
.notifications-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--dp-text-muted);
}

.notifications-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.notifications-empty i {
    font-size: 32px;
    opacity: 0.5;
}

.notifications-empty p {
    margin: 0;
    font-size: 14px;
}

.notifications-error {
    padding: 20px;
    text-align: center;
    color: var(--dp-danger);
    font-size: 14px;
}

/* Тёмная тема для уведомлений */
[data-theme="dark"] .notification-item.unread {
    background: rgba(124, 58, 237, 0.15);
}

[data-theme="dark"] .notification-item.unread:hover {
    background: rgba(124, 58, 237, 0.2);
}

[data-theme="dark"] .notification-title {
    color: #ffffff;
}

[data-theme="dark"] .notification-message {
    color: #b0bac8;
}

/* ============================================
   Notifications Footer
   ============================================ */
.notifications-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--dp-border-color);
    background: var(--dp-body-bg);
}

.notifications-footer-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--dp-primary);
    text-decoration: none;
    border-radius: var(--dp-border-radius);
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
}

.notifications-footer-link:hover {
    background: var(--dp-menu-hover);
    color: var(--dp-primary);
}

/* ============================================
   Full Notifications List (Page)
   ============================================ */
.notifications-list-full {
    max-height: none;
    overflow-y: visible;
}

.notification-item-full {
    display: flex;
    padding: 20px 28px;
    border-bottom: 1px solid var(--dp-border-color);
    transition: background 0.2s ease;
}

.notification-item-full:last-child {
    border-bottom: none;
}

.notification-item-full:hover {
    background: var(--dp-menu-hover);
}

.notification-item-full.unread {
    background: rgba(124, 58, 237, 0.05);
    border-left: 3px solid var(--dp-primary);
}

.notification-item-full.unread:hover {
    background: rgba(124, 58, 237, 0.1);
}

.notification-item-full .notification-icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
    margin-right: 16px;
}

.notification-item-full .notification-title {
    font-size: 15px;
    margin-bottom: 6px;
}

.notification-item-full .notification-message {
    font-size: 14px;
    margin-bottom: 8px;
    /* -webkit-line-clamp: 3; */
}

.notification-item-full .notification-time {
    font-size: 12px;
}

/* Тёмная тема для полного списка уведомлений */
[data-theme="dark"] .notification-item-full.unread {
    background: rgba(124, 58, 237, 0.15);
}

[data-theme="dark"] .notification-item-full.unread:hover {
    background: rgba(124, 58, 237, 0.2);
}

/* ============================================
   Header User Avatar Dropdown
   ============================================ */

.header-avatar-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.header-avatar-btn:hover .header-user-name {
    color: var(--dp-primary);
}

.header-avatar-btn::after {
    display: none;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.header-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--dp-text-primary);
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
    line-height: 1.2;
}

.header-user-organization {
    font-size: 11px;
    font-weight: 500;
    color: var(--dp-text-muted);
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.header-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--dp-border-color);
    object-fit: cover;
    transition: border-color 0.2s ease;
}

.header-avatar-btn:hover .header-avatar-img {
    border-color: var(--dp-primary);
}

.header-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--dp-border-color);
    font-size: 16px;
    font-weight: 700;
    color: var(--dp-primary);
    background: rgba(124, 58, 237, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease;
}

.header-avatar-btn:hover .header-avatar-placeholder {
    border-color: var(--dp-primary);
}

/* Dropdown Menu */
.header-user-dropdown .dropdown-menu {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--dp-border-color);
    border-radius: var(--dp-border-radius);
    box-shadow: var(--dp-shadow-lg);
    background: var(--dp-card-bg);
    min-width: 200px;
}

.header-user-dropdown .dropdown-item {
    padding: 10px 16px;
    border-radius: 8px;
    color: var(--dp-text-primary);
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.header-user-dropdown .dropdown-item:hover {
    background: var(--dp-menu-hover);
    color: var(--dp-primary);
}

.header-user-dropdown .dropdown-item.text-danger {
    color: var(--dp-danger);
}

.header-user-dropdown .dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--dp-danger);
}

.header-user-dropdown .dropdown-item i {
    font-size: 16px;
    width: 18px;
    text-align: center;
}

.header-user-dropdown .dropdown-divider {
    margin: 8px 0;
    border-color: var(--dp-border-color);
}

/* ============================================
   Settings Modal
   ============================================ */
.settings-section {
    margin-bottom: 24px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--dp-text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

.settings-section-title i {
    color: var(--dp-primary);
}

/* Theme Selector */
.theme-selector {
    display: flex;
    gap: 12px;
}

.theme-option {
    flex: 1;
    cursor: pointer;
}

.theme-option input {
    display: none;
}

.theme-option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    border: 2px solid var(--dp-border-color);
    border-radius: var(--dp-border-radius);
    transition: all 0.2s ease;
    background: var(--dp-body-bg);
}

.theme-option input:checked + .theme-option-card {
    border-color: var(--dp-primary);
    background: rgba(124, 58, 237, 0.05);
}

.theme-option:hover .theme-option-card {
    border-color: var(--dp-primary);
}

.theme-preview {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    font-size: 20px;
}

.theme-preview-light {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.theme-preview-dark {
    background: #1e293b;
    color: #94a3b8;
}

.theme-preview-system {
    background: linear-gradient(135deg, #f8fafc 50%, #1e293b 50%);
    color: var(--dp-primary);
}

[data-theme="dark"] .theme-preview-light {
    background: #f8fafc;
    color: #475569;
}

[data-theme="dark"] .theme-preview-dark {
    background: #1e293b;
    color: #94a3b8;
}

.theme-option-card span {
    font-size: 12px;
    font-weight: 600;
    color: var(--dp-text-secondary);
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-notification {
    position: fixed;
    bottom: 100px;
    right: 25px;
    padding: 14px 20px;
    background: var(--dp-card-bg);
    border: 1px solid var(--dp-border-color);
    border-radius: var(--dp-border-radius);
    box-shadow: var(--dp-shadow-lg);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification.toast-success {
    border-left: 4px solid var(--dp-success);
    color: var(--dp-success);
}

.toast-notification.toast-error {
    border-left: 4px solid var(--dp-danger);
    color: var(--dp-danger);
}

.toast-notification i {
    font-size: 18px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--dp-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
}

.header-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-user-name {
    font-weight: 600;
    color: var(--dp-text-primary);
    font-size: 14px;
}

.header-user-phone {
    font-size: 12px;
    color: var(--dp-text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-actions .btn {
    padding: 8px 12px;
}

/* Search Results Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--dp-card-bg);
    border: 1px solid var(--dp-border-color);
    border-radius: var(--dp-border-radius);
    box-shadow: var(--dp-shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    margin-top: 8px;
    display: none;
    z-index: 1000;
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--dp-border-color);
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    color: var(--dp-text-primary);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--dp-menu-hover);
}

.search-result-item i {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 14px;
}

.search-result-item.task i {
    background: rgba(124, 58, 237, 0.15);
    color: var(--dp-primary);
}

.search-result-item.user i {
    background: rgba(16, 185, 129, 0.15);
    color: var(--dp-success);
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 12px;
    color: var(--dp-text-muted);
}

.search-no-results {
    padding: 24px;
    text-align: center;
    color: var(--dp-text-muted);
}

.search-no-results i {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Main content with header */
.main-content.has-header {
    padding-top: calc(var(--dp-header-height) + 30px);
}

/* Mobile search toggle - скрыт по умолчанию (показывается только в мобильном режиме) */
.mobile-search-toggle {
    display: none;
}

/* Mobile search bar - скрыт по умолчанию */
.mobile-search-bar {
    display: none;
}

/* Responsive header */
@media (max-width: 991px) {
    /* Layout header - fixed at top on mobile, horizontal layout */
    .layout-header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        background: var(--dp-card-bg);
        z-index: 200;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        height: 70px;
    }
    
    /* Show both headers on mobile - inline */
    .mobile-header {
        display: flex;
        height: 50px;
        border-bottom: none;
        padding: 0 10px;
    }
    
    .global-header {
        display: flex !important;
        position: relative;
        height: 50px;
        padding: 0 10px;
        border-bottom: none;
        flex: 1;
        justify-content: flex-end;
    }
    
    .global-header .header-brand {
        display: none;
    }
    
    .global-header .desktop-search {
        display: none !important;
    }
    
    .global-header .header-actions {
        position: relative;
        right: 0;
        top: 0;
        transform: none;
    }
    
    .header-user-info {
        display: none;
    }
    
    .mobile-search-bar {
        position: relative;
        top: 0;
    }
    
    .app-container {
        padding-top: 60px; /* Mobile header height */
        padding-bottom: 60px; /* Mobile footer height */
    }
    
    /* Show footer on mobile - fixed at bottom */
    .layout-footer {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    .header-brand {
        display: none;
    }

    .global-search {
        max-width: 100%;
    }
    
    .header-user-name,
    .header-user-phone,
    .header-user-organization {
        display: none;
    }
    
    /* Desktop search hidden on mobile */
    .desktop-search {
        display: none !important;
    }
    
    /* Mobile search toggle button */
    .mobile-search-toggle {
        display: flex;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: none;
        background: transparent;
        color: var(--dp-text-secondary);
        font-size: 20px;
        cursor: pointer;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
    }
    
    .mobile-search-toggle:hover {
        background: var(--dp-menu-hover);
        color: var(--dp-primary);
    }
    
    /* Mobile search bar */
    .mobile-search-bar {
        position: fixed;
        top: 50px;
        left: 0;
        right: 0;
        background: var(--dp-card-bg);
        border-bottom: 1px solid var(--dp-border-color);
        padding: 12px 20px;
        display: none;
        z-index: 199;
        box-shadow: var(--dp-shadow-sm);
    }
    
    .mobile-search-bar.show {
        display: block;
        animation: slideDown 0.2s ease;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .mobile-search-bar .global-search {
        max-width: 100%;
        margin-left: 0;
    }
    
    .mobile-search-close {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: var(--dp-text-muted);
        cursor: pointer;
        padding: 4px 8px;
        border-radius: 4px;
    }
    
    .mobile-search-close:hover {
        background: var(--dp-menu-hover);
        color: var(--dp-text-primary);
    }
    
    .mobile-search-bar .global-search {
        position: relative;
        padding-right: 40px;
    }
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--dp-border-color);
}

.page-header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.page-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header-title i {
    color: var(--dp-primary);
    font-size: 24px;
}

.page-header-title h1 {
    font-size: 26px;
    font-weight: 800;
    color: #009688;
    margin: 0;
    letter-spacing: -0.5px;
}

.page-header-actions {
    display: flex;
    gap: 12px;
}

.page-title {
    font-size: 26px;
    font-weight: 800;
    color: #009688;
    margin: 0;
    letter-spacing: -0.5px;
}

.page-title i {
    color: var(--dp-primary);
    margin-right: 12px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--dp-card-bg);
    border: 1px solid var(--dp-border-color);
    border-radius: var(--dp-border-radius);
    box-shadow: var(--dp-shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--dp-shadow);
}

.card-header {
    padding: 20px 28px;
    border-bottom: 1px solid var(--dp-border-color);
    background: transparent;
}

.card-header h3,
.card-header h4,
.card-header h5 {
    margin: 0;
    font-weight: 700;
    color: #009688;
    font-size: 16px;
}

.card-body {
    padding: 24px 28px;
}

.card-body.p-0 {
    padding: 0;
}

/* ============================================
   Buttons - HookListener Style
   ============================================ */
.btn {
    padding: 12px 24px;
    border-radius: var(--dp-border-radius);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--dp-primary);
    color: var(--dp-text-white);
    /* box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35); */
}

.btn-primary:hover {
    background: var(--dp-primary-hover);
    color: var(--dp-text-white);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(124, 58, 237, 0.45);
}

.btn-secondary {
    background: var(--dp-secondary);
    color: var(--dp-text-white);
}

.btn-secondary:hover {
    background: #475569;
    color: var(--dp-text-white);
}

.btn-danger {
    background: var(--dp-danger);
    color: var(--dp-text-white);
}

.btn-danger:hover {
    background: #dc2626;
    color: var(--dp-text-white);
}

.btn-success {
    background: var(--dp-success);
    color: var(--dp-text-white);
}

.btn-success:hover {
    background: #059669;
    color: var(--dp-text-white);
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--dp-primary);
    color: var(--dp-primary);
}

.btn-outline-primary:hover {
    background: var(--dp-primary);
    color: var(--dp-text-white);
}

.btn-outline-secondary {
    background: transparent;
    border: 2px solid var(--dp-border-color);
    color: var(--dp-text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--dp-secondary);
    color: var(--dp-text-white);
    border-color: var(--dp-secondary);
}

.btn-outline-danger {
    background: transparent;
    border: 2px solid var(--dp-danger);
    color: var(--dp-danger);
}

.btn-outline-danger:hover {
    background: var(--dp-danger);
    color: var(--dp-text-white);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* ============================================
   Forms
   ============================================ */
.form-label {
    font-weight: 600;
    color: var(--dp-text-primary);
    margin-bottom: 10px;
    font-size: 14px;
}

.form-control,
.form-select {
    padding: 14px 18px;
    border: 2px solid var(--dp-border-color);
    border-radius: var(--dp-border-radius);
    background: var(--dp-card-bg);
    color: var(--dp-text-primary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--dp-primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
    outline: none;
    background: var(--dp-card-bg);
    color: var(--dp-text-primary);
}

.form-control::placeholder {
    color: var(--dp-text-muted);
    font-weight: 400;
}

/* ============================================
   Badges
   ============================================ */
.badge {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
}

.badge-primary { background: var(--dp-primary); color: white; }
.badge-secondary { background: var(--dp-secondary); color: white; }
.badge-success { background: var(--dp-success); color: white; }
.badge-danger { background: var(--dp-danger); color: white; }
.badge-warning { background: var(--dp-warning); color: #0f172a; }
.badge-info { background: var(--dp-info); color: white; }
.badge-dark { background: var(--dp-dark); color: white; }

/* ============================================
   Alerts
   ============================================ */
.alert {
    padding: 20px 24px;
    border-radius: var(--dp-border-radius);
    border: none;
    margin-bottom: 24px;
    font-weight: 600;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--dp-success);
    border-left: 4px solid var(--dp-success);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--dp-danger);
    border-left: 4px solid var(--dp-danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
    border-left: 4px solid var(--dp-warning);
}

.alert-info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--dp-info);
    border-left: 4px solid var(--dp-info);
}

/* ============================================
   Modal
   ============================================ */
.modal-header {
    background: var(--dp-card-bg);
    border-bottom: 1px solid var(--dp-border-color);
    padding: 24px 28px;
    border-radius: var(--dp-border-radius) var(--dp-border-radius) 0 0;
}

.modal-title {
    font-weight: 700;
    color: var(--dp-text-primary);
    font-size: 18px;
}

.modal-title i {
    color: var(--dp-primary);
    margin-right: 10px;
}

.modal-body {
    background: var(--dp-card-bg);
    padding: 28px;
}

.modal-footer {
    background: var(--dp-body-bg);
    border-top: 1px solid var(--dp-border-color);
    padding: 20px 28px;
    border-radius: 0 0 var(--dp-border-radius) var(--dp-border-radius);
}

.modal-content {
    background: var(--dp-card-bg);
    border: 1px solid var(--dp-border-color);
    border-radius: var(--dp-border-radius);
    box-shadow: var(--dp-shadow-lg);
}

.btn-close {
    filter: var(--btn-close-filter, none);
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) brightness(0.8);
}

/* ============================================
   Task List
   ============================================ */
.task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.task-item {
    display: flex;
    align-items: flex-start;
    padding: 22px 28px;
    background: var(--dp-card-bg);
    border-bottom: 1px solid var(--dp-border-color);
    transition: all 0.2s ease;
}

.task-item:last-child {
    border-bottom: none;
}

.task-item:hover {
    background: var(--dp-menu-hover);
}

.task-content {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-weight: 700;
    color: var(--dp-text-primary);
    margin-bottom: 4px;
    font-size: 15px;
}

.task-description {
    color: var(--dp-text-secondary);
    font-size: 13px;
    margin-bottom: 8px;
    line-height: 1.5;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 12px;
    color: var(--dp-text-muted);
    font-weight: 600;
}

.task-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.task-meta i {
    font-size: 12px;
}

.task-actions {
    display: flex;
    gap: 8px;
    margin-left: 20px;
    flex-shrink: 0;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--dp-text-secondary);
}

.empty-state-icon {
    font-size: 70px;
    margin-bottom: 20px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 15px;
    font-weight: 600;
}

/* ============================================
   Menu Toggle (Mobile)
   ============================================ */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    width: 45px;
    height: 40px;
    background: var(--dp-primary);
    border: none;
    border-radius: var(--dp-border-radius);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    box-shadow: none;
    transition: all 0.3s ease;
    z-index: 1001;
}

.menu-toggle:hover {
    background: var(--dp-primary-hover);
}

/* Mobile Header with Brand */
.mobile-header {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    z-index: 1001;
    align-items: center;
    gap: 12px;
    padding: 0 15px;
    background: var(--dp-card-bg);
    border-bottom: 1px solid var(--dp-border-color);
}

.mobile-header > * {
    pointer-events: auto;
}

.mobile-header .menu-toggle {
    position: static;
    top: auto;
    left: auto;
    flex-shrink: 0;
}

.mobile-brand {
    display: none;
    font-size: 18px;
    font-weight: 800;
    color: var(--dp-primary);
    white-space: nowrap;
    text-decoration: none;
}

.mobile-brand:hover {
    color: var(--dp-primary-hover);
}

/* ============================================
   Sidebar Collapse Button
   ============================================ */
.sidebar-collapse {
    position: fixed;
    top: 18px;
    left: var(--dp-sidebar-width);
    width: 28px;
    height: 28px;
    background: var(--dp-card-bg);
    border: 1px solid var(--dp-border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--dp-text-secondary);
    font-size: 14px;
    box-shadow: var(--dp-shadow-sm);
    transition: all 0.3s ease;
    z-index: 101;
}

.sidebar-collapse:hover {
    background: var(--dp-primary);
    color: white;
    border-color: var(--dp-primary);
}

/* ============================================
   Table Actions Cell - горизонтальное размещение кнопок
   ============================================ */
.actions-cell {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

.actions-cell .btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ============================================
   Стили для полей ввода
   ============================================ */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    padding: 10px;
}

/* ============================================
   Soft delete - зачёркнутый текст для удалённых записей
   ============================================ */
tr.is-deleted td,
tr.is-deleted td a,
tr.is-deleted td span,
tr.is-deleted td strong,
tr.is-deleted td .role-badge,
tr.is-deleted td .priority-badge,
tr.is-deleted td .status-badge,
tr.is-deleted td .task-title-link,
tr.is-deleted td .task-name,
tr.is-deleted td .task-id,
tr.is-deleted td .task-description {
    text-decoration: line-through !important;
    color: #999 !important;
    opacity: 0.7;
}

tr.is-deleted {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

[data-theme="dark"] tr.is-deleted {
    background-color: rgba(255, 255, 255, 0.02) !important;
}

tr.is-deleted:hover {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="dark"] tr.is-deleted:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* ============================================
   Submenu (Admin)
   ============================================ */
.sidebar-submenu {
    margin-bottom: 4px;
}

.sidebar-submenu-toggle {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--dp-text-secondary);
    text-decoration: none;
    border-radius: var(--dp-border-radius);
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.sidebar-submenu-toggle:hover {
    background: var(--dp-menu-hover);
    color: var(--dp-primary);
}

.sidebar-submenu-toggle.active {
    background: var(--dp-menu-active);
    color: var(--dp-primary);
    font-weight: 700;
}

.sidebar-submenu-toggle .bi-chevron-down {
    font-size: 12px;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.sidebar-submenu-toggle.active .bi-chevron-down {
    transform: rotate(180deg);
}

.sidebar-submenu-content {
    display: none;
    padding-left: 15px;
    margin-top: 4px;
}

.sidebar-submenu-content.show {
    display: block;
}

.sidebar-submenu-content a {
    padding: 10px 15px 10px 30px;
    font-size: 13px;
    color: var(--dp-text-muted);
}

.sidebar-submenu-content a:hover {
    color: var(--dp-primary);
    background: var(--dp-menu-hover);
}

.sidebar-submenu-content a.active {
    color: var(--dp-primary);
    background: var(--dp-menu-active);
}

.sidebar-submenu-content a i {
    margin-right: 10px;
    width: 16px;
    font-size: 14px;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease forwards;
}

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

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

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }
    
    .mobile-brand {
        display: block;
    }
    
    .sidebar-collapse {
        display: none;
    }

    .header-user-name {
        display: none;
    }
    
    .header-actions {
        right: 15px;
    }

    /* Mobile Footer */
    .mobile-footer {
        display: flex;
        background: var(--dp-card-bg);
        border-top: 1px solid var(--dp-border-color);
        justify-content: space-around;
        padding: 4px 0;
        box-shadow: var(--dp-shadow-sm);
    }

    .mobile-footer-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--dp-text-muted);
        padding: 4px 12px;
        transition: color 0.2s ease;
    }

    .mobile-footer-item i {
        font-size: 22px;
        font-weight: 700;
        margin-bottom: 2px;
        color: var(--dp-primary);
    }

    .mobile-footer-item span {
        font-size: 10px;
        font-weight: 500;
    }

    .mobile-footer-item.active {
        color: var(--dp-primary);
    }

    .main-content {
        padding-bottom: 0;
    }
}

@media (max-width: 576px) {
    .notifications-dropdown {
        width: calc(100vw - 20px);
        right: -60px;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 24px 20px;
    }

    .page-title {
        font-size: 22px;
    }
    
    .page-header {
        margin-bottom: 24px;
        padding-bottom: 18px;
    }
    
    .task-item {
        flex-direction: column;
        padding: 20px;
    }
    
    .task-actions {
        margin-left: 0;
        margin-top: 18px;
        width: 100%;
    }
    
    .task-actions .btn {
        flex: 1;
    }
    
    .modal-dialog {
        margin: 16px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .card-header {
        padding: 16px 20px;
    }
}

/* ============================================
   Main content без sidebar
   ============================================ */
.main-content.no-sidebar {
    margin-left: 0;
    max-width: 100%;
    /* padding-top: 50px; */
}

/* ============================================
   Utility Classes
   ============================================ */
.text-primary { color: var(--dp-primary) !important; }
.text-secondary { color: var(--dp-text-secondary) !important; }
.text-success { color: var(--dp-success) !important; }
.text-danger { color: var(--dp-danger) !important; }
.text-warning { color: var(--dp-warning) !important; }
.text-muted { color: var(--dp-text-muted) !important; }

.bg-primary { background-color: var(--dp-primary) !important; }
.bg-secondary { background-color: var(--dp-secondary) !important; }
.bg-success { background-color: var(--dp-success) !important; }
.bg-danger { background-color: var(--dp-danger) !important; }
.bg-warning { background-color: var(--dp-warning) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 5px !important; }
.mb-2 { margin-bottom: 10px !important; }
.mb-3 { margin-bottom: 15px !important; }
.mb-4 { margin-bottom: 20px !important; }
.mb-5 { margin-bottom: 25px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: 10px !important; }
.mt-3 { margin-top: 15px !important; }
.mt-4 { margin-top: 20px !important; }

.me-1 { margin-right: 5px !important; }
.me-2 { margin-right: 10px !important; }
.ms-1 { margin-left: 5px !important; }
.ms-2 { margin-left: 10px !important; }
.ms-auto { margin-left: auto !important; }

.d-flex { display: flex !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-2 { gap: 10px !important; }
.gap-3 { gap: 15px !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.flex-grow-1 { flex-grow: 1 !important; }

.text-center { text-align: center !important; }
.text-end { text-align: right !important; }

.w-100 { width: 100% !important; }

.p-0 { padding: 0 !important; }
.p-2 { padding: 10px !important; }
.p-3 { padding: 15px !important; }
.p-4 { padding: 20px !important; }

.list-unstyled { list-style: none !important; }


/* ============================================
   Admin Dashboard Styles
   ============================================ */

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--dp-card-bg);
    border: 1px solid var(--dp-border-color);
    border-radius: 12px;
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 24px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--dp-shadow-lg);
    border-color: var(--dp-primary);
}

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

.stat-icon.users { background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%); color: white; }
.stat-icon.roles { background: linear-gradient(135deg, #10b981 0%, #34d399 100%); color: white; }
.stat-icon.permissions { background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%); color: white; }
.stat-icon.objects { background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%); color: white; }
.stat-icon.logs { background: linear-gradient(135deg, #ef4444 0%, #f87171 100%); color: white; }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--dp-text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--dp-text-muted);
    font-weight: 600;
    margin-top: 4px;
}

.stat-arrow {
    color: var(--dp-text-muted);
    font-size: 20px;
    opacity: 0;
    transition: all 0.3s ease;
}

.stat-card:hover .stat-arrow {
    opacity: 1;
    transform: translateX(5px);
}

/* Table wrapper for mobile */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .card-body {
        overflow-x: hidden;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .table-wrapper {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }
}

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.admin-table thead th {
    background: var(--dp-body-bg);
    padding: 16px 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--dp-text-muted);
    border-bottom: 2px solid var(--dp-border-color);
    text-align: left;
}

.admin-table tbody tr {
    transition: all 0.2s ease;
}

.admin-table tbody tr:hover {
    background: var(--dp-menu-hover);
}

.admin-table tbody td {
    padding: 15px 15px;
    border-bottom: 1px solid var(--dp-border-color);
    vertical-align: middle;
    color: var(--dp-text-primary);
}

/* Тёмная тема для таблиц */
[data-theme="dark"] .admin-table tbody td {
    color: #e8ecf2;
}

[data-theme="dark"] .admin-table .user-name {
    color: #ffffff;
}

[data-theme="dark"] .admin-table .user-phone {
    color: #b0bac8;
}

[data-theme="dark"] .admin-table thead th {
    color: #b0bac8;
}

/* Тёмная тема для названий задач */
[data-theme="dark"] .task-name {
    color: #ffffff !important;
}

[data-theme="dark"] .task-id {
    color: #b0bac8 !important;
}

[data-theme="dark"] .task-description {
    color: #9aa5b5 !important;
}

/* Тёмная тема для текста в ячейках таблиц */
[data-theme="dark"] .text-muted {
    color: #9aa5b5 !important;
}

/* Тёмная тема для ссылок на задачи */
[data-theme="dark"] .task-title-link {
    color: #e8ecf2;
}

[data-theme="dark"] .task-title-link:hover {
    color: var(--dp-primary);
}

[data-theme="dark"] .task-title-link:hover .task-name {
    color: var(--dp-primary);
}

/* Тёмная тема для иконок в таблицах */
[data-theme="dark"] .admin-table td i {
    color: #b0bac8;
}

.admin-table .user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-table .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.admin-table .user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-table .user-info {
    min-width: 0;
}

.admin-table .user-name {
    font-weight: 700;
    color: var(--dp-text-primary);
    margin-bottom: 2px;
}

.admin-table .user-phone {
    font-size: 12px;
    color: var(--dp-text-muted);
}

.admin-table .actions-cell {
    text-align: right;
    vertical-align: middle;
}

.admin-table .actions-cell .btn {
    display: inline-flex !important;
    margin-right: 4px;
}

.admin-table .actions-cell .btn:last-child {
    margin-right: 0;
}

.admin-table .actions-cell .btn {
    /* padding: 6px 10px; */
    font-size: 21px;
}

/* Role Badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-right: 4px;
    margin-bottom: 4px;
}

.role-badge.is-deleted {
    text-decoration: line-through;
    opacity: 0.6;
}

.role-badge.admin { background: rgba(124, 58, 237, 0.15); color: #7c3aed; }
.role-badge.manager { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.role-badge.user { background: rgba(100, 116, 139, 0.15); color: #64748b; }
.role-badge.operator { background: rgba(6, 182, 212, 0.15); color: #06b6d4; }

/* Тёмная тема для бейджей */
[data-theme="dark"] .role-badge.admin { background: rgba(124, 58, 237, 0.3); color: #a78bfa; }
[data-theme="dark"] .role-badge.manager { background: rgba(16, 185, 129, 0.3); color: #34d399; }
[data-theme="dark"] .role-badge.user { background: rgba(100, 116, 139, 0.3); color: #94a3b8; }
[data-theme="dark"] .role-badge.operator { background: rgba(6, 182, 212, 0.3); color: #22d3ee; }

/* Search Form */
.search-form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.search-form .form-control {
    flex: 1;
    max-width: 400px;
}

/* Filters */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px;
    background: var(--dp-card-bg);
    border: 1px solid var(--dp-border-color);
    border-radius: 12px;
    margin-bottom: 24px;
}

.filters-bar .form-group {
    min-width: 150px;
}

.filters-bar .form-control,
.filters-bar .form-select {
    width: 100%;
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-top: 20px;
    border-top: 1px solid var(--dp-border-color);
}

.pagination-info {
    font-size: 13px;
    color: var(--dp-text-muted);
    font-weight: 600;
}

.pagination {
    margin: 0;
}

.page-link {
    border: none;
    padding: 8px 14px;
    margin: 0 2px;
    border-radius: 8px;
    color: var(--dp-text-secondary);
    font-weight: 600;
    font-size: 13px;
    background: transparent;
}

.page-link:hover {
    background: var(--dp-menu-hover);
    color: var(--dp-primary);
}

.page-item.active .page-link {
    background: var(--dp-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
}

.page-item.disabled .page-link {
    color: var(--dp-text-muted);
    opacity: 0.5;
}

/* Logs Table */
.logs-table {
    font-size: 13px;
}

.logs-table .timestamp-cell {
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.logs-table .method-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.logs-table .method-badge.get { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.logs-table .method-badge.post { background: rgba(124, 58, 237, 0.15); color: #7c3aed; }
.logs-table .method-badge.put { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.logs-table .method-badge.delete { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.logs-table .method-badge.patch { background: rgba(6, 182, 212, 0.15); color: #0891b2; }

.logs-table .status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.logs-table .status-badge.success { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.logs-table .status-badge.redirect { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.logs-table .status-badge.client-error { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.logs-table .status-badge.server-error { background: rgba(220, 38, 38, 0.2); color: #dc2626; }

.logs-table .path-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Back Button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--dp-text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    margin-left: -10px;
}

.back-btn:hover {
    background: var(--dp-menu-hover);
    color: var(--dp-primary);
}

/* Card Actions */
.card-header-actions {
    display: flex;
    gap: 10px;
}

/* Status Toggle */
.status-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--dp-border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.status-toggle.active {
    background: var(--dp-success);
}

.status-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.status-toggle.active::after {
    left: 22px;
}

/* Empty Table */
.table-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--dp-text-muted);
}

.table-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.table-empty p {
    font-size: 15px;
    font-weight: 600;
}

/* Form Rows */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

/* Checkbox Custom */
.form-check-custom .form-check-input {
    width: 20px;
    height: 20px;
    margin-top: 0;
    cursor: pointer;
}

.form-check-custom .form-check-label {
    padding-left: 8px;
    cursor: pointer;
    font-weight: 500;
}

/* Responsive Admin */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .stat-card {
        padding: 24px;
    }
    
    .stat-icon {
        width: 56px;
        height: 56px;
        font-size: 26px;
    }
    
    .stat-value {
        font-size: 26px;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-form .form-control {
        max-width: 100%;
    }
    
    .filters-bar {
        flex-direction: column;
        padding: 24px;
    }
    
    .filters-bar .form-group {
        width: 100%;
    }
    
    .admin-table {
        font-size: 13px;
    }
    
    .admin-table thead th,
    .admin-table tbody td {
        padding: 14px 12px;
    }
    
    .pagination-wrapper {
        flex-direction: column;
        gap: 18px;
        padding: 24px;
    }
}

/* Animation for cards */
.stat-card {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.15s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4) { animation-delay: 0.25s; }
.stat-card:nth-child(5) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn {
    padding: 10px 20px;
}

/* ============================================
   Page Header Actions
   ============================================ */
.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0px;
}

.page-header-actions .back-btn {
    margin-left: 0;
}

/* ============================================
   Filter Icon Button (без рамки)
   ============================================ */
.filter-icon-btn {
    background: transparent;
    border: none;
    color: var(--dp-text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-icon-btn:hover {
    color: var(--dp-primary);
    background: var(--dp-menu-hover);
}

/* ============================================
   Filter Toggles в модальном окне
   ============================================ */
.filter-toggles {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--dp-border-color);
}

.filter-toggles-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--dp-text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

.filter-toggles-title i {
    color: var(--dp-primary);
}

.filter-toggles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.filter-toggles-grid .form-check {
    padding: 10px 16px;
    background: var(--dp-body-bg);
    border-radius: 8px;
    margin: 0;
    transition: all 0.2s ease;
}

.filter-toggles-grid .form-check:hover {
    background: var(--dp-menu-hover);
}

.filter-toggles-grid .form-check-input {
    width: 2.5em;
    height: 1.25em;
    cursor: pointer;
}

.filter-toggles-grid .form-check-input:checked {
    background-color: var(--dp-primary);
    border-color: var(--dp-primary);
}

.filter-toggles-grid .form-check-label {
    cursor: pointer;
    font-weight: 500;
    color: var(--dp-text-secondary);
    user-select: none;
}

/* ============================================
   Action Button Wrapper (для бейджа над кнопкой)
   ============================================ */
.action-btn-wrapper {
    position: relative;
    display: inline-flex;
}

/* Бейдж с количеством активных фильтров */
.filter-count-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--dp-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.4);
}

/* ============================================
   Task Title Link (кликабельное название задачи)
   ============================================ */
.task-title-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 4px 0;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.task-title-link:hover {
    color: var(--dp-primary);
}

.task-title-link:hover .task-name {
    text-decoration: underline;
}

.task-title-link .task-id {
    color: var(--dp-text-muted);
    font-size: 12px;
    margin-right: 8px;
    font-weight: 500;
}

.task-title-link:hover .task-id {
    color: var(--dp-primary);
}

.task-title-link .task-name {
    color: var(--dp-text-primary);
}

.task-title-link .task-description {
    font-size: 11px;
    color: var(--dp-text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* ============================================
   Color Picker
   ============================================ */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker-input {
    width: 50px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--dp-border-color);
    border-radius: var(--dp-border-radius);
    cursor: pointer;
}

.color-picker-input::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker-input::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}

.color-text-input {
    width: 120px;
    font-family: monospace;
    text-transform: uppercase;
}

.color-preview {
    flex: 1;
    min-height: 60px;
    border-radius: var(--dp-border-radius);
    border: 1px solid var(--dp-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.form-control-color {
    padding: 4px;
    height: 38px;
}