/* ==========================================================================
   SellerNow - Marketplace Management System
   Business Colors, Minimalist Design, Responsive
   ========================================================================== */

/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;

    --bg-color: #f1f5f9;
    --bg-sidebar: #1e293b;
    --bg-card: #ffffff;
    --bg-header: #ffffff;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;

    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;

    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--text-white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: width 0.3s ease;
    left: 0;
    top: 0;
}

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

.sidebar.collapsed .logo-text {
    display: none;
}

.sidebar.collapsed .sidebar-menu a span:not(.mp-icon-small) {
    display: none;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .sidebar-menu i {
    margin-right: 0;
    width: auto;
}

.sidebar.collapsed .menu-group .group-toggle .icon-arrow {
    display: none;
}

.sidebar.collapsed .submenu {
    display: none !important;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: padding 0.3s ease;
}

.sidebar.collapsed .sidebar-header {
    padding: 0 12px;
}

.logo {
    color: var(--text-white);
    font-size: 1.5rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
}

.logo:hover {
    color: var(--text-white);
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-white);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: transform 0.3s ease;
}

.sidebar-toggle-btn:hover {
    transform: scale(1.1);
}

.sidebar-menu {
    padding: 15px 0;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    margin: 2px 0;
    position: relative;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s;
    position: relative;
}

.sidebar-menu a:hover,
.sidebar-menu li.active > a {
    color: var(--text-white);
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-menu i {
    width: 24px;
    margin-right: 12px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Tooltip для свёрнутого меню */
.sidebar.collapsed .sidebar-menu a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.9);
    color: var(--text-white);
    padding: 8px 12px;
    border-radius: var(--radius);
    white-space: nowrap;
    margin-left: 10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1001;
    font-size: 0.85rem;
}

.sidebar.collapsed .sidebar-menu a:hover::after {
    opacity: 1;
}

/* Menu Group */
.menu-group .group-toggle {
    justify-content: space-between;
}

.menu-group .group-toggle .icon-arrow {
    margin-left: auto;
    margin-right: 0;
    transition: transform 0.2s;
}

.menu-group.open .group-toggle .icon-arrow {
    transform: rotate(180deg);
}

.submenu {
    display: block;
    max-height: 0;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.2);
    transition: max-height 0.3s ease;
}

.menu-group.open > .submenu {
    max-height: none;
}

.submenu a {
    padding-left: 24px;
    font-size: 0.9rem;
}

/* Nested marketplace submenus (2nd level) */
.menu-group-nested {
    list-style: none;
}

.menu-group-nested > .group-toggle {
    padding-left: 16px;
    font-size: 0.9rem;
}

.menu-group-nested > .group-toggle .icon-arrow {
    font-size: 0.65rem;
    margin-left: auto;
}

.submenu-nested {
    background-color: rgba(0, 0, 0, 0.15) !important;
}

.submenu-nested a {
    padding-left: 24px !important;
    font-size: 0.85rem !important;
}

.submenu-nested a i {
    font-size: 0.8rem;
    margin-right: 8px;
    opacity: 0.7;
    width: 14px;
    text-align: center;
}

.mp-icon-small {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
    flex-shrink: 0;
}

/* 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;
}

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

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

/* Header */
.header {
    height: var(--header-height);
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle-mobile {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--bg-color);
    border-radius: var(--radius);
    padding: 8px 12px;
    width: 300px;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    flex: 1;
    font-size: 0.9rem;
}

.search-bar button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

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

.company-selector {
    position: relative;
}

.company-selector-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 6px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    max-width: 240px;
}

.company-selector-toggle:hover {
    background-color: var(--bg-color);
    border-color: var(--primary-color);
}

.company-selector-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.company-selector-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.company-selector.open .company-selector-arrow {
    transform: rotate(180deg);
}

.company-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1100;
}

.company-dropdown-menu.show {
    display: block;
}

.company-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.company-dropdown-add {
    display: inline-block;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 500;
}

.company-dropdown-add:hover {
    color: var(--primary-dark);
}

.company-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid var(--border-color);
}

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

.company-dropdown-item:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.company-dropdown-item.active {
    background-color: #f0f5ff;
}

.company-dropdown-info {
    flex: 1;
    min-width: 0;
}

.company-dropdown-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.company-dropdown-id {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 2px;
}

.company-dropdown-check {
    flex-shrink: 0;
    color: var(--primary-color);
    margin-left: 8px;
}

.notifications-btn {
    position: relative;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.notifications-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
}

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

.user-info {
    text-align: right;
}

.username {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-light);
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--radius);
}

.dropdown-toggle:hover {
    background-color: var(--bg-color);
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    margin-top: 8px;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background-color: var(--bg-color);
}

.dropdown-menu .divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

/* Content */
.content {
    flex: 1;
    padding: 24px;
}

.footer {
    padding: 16px 24px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

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

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header h1 i {
    color: var(--primary-color);
}

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

.section-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

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

.btn-danger:hover {
    background-color: #dc2626;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 0;
}

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

.btn-search {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 16px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.btn-action:hover {
    background-color: var(--bg-color);
}

.btn-action.view:hover {
    color: var(--info-color);
}

.btn-action.edit:hover {
    color: var(--warning-color);
}

.btn-action.delete:hover {
    color: var(--danger-color);
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

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

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.dashboard-card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-card-mini {
    padding: 14px 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--border-color);
}

.stat-card-mini .stat-content {
    text-align: center;
}

.stat-card-mini .stat-value {
    font-size: 1.3rem;
    font-weight: 600;
}

.stat-card-mini .stat-label {
    font-size: 0.78rem;
    margin-top: 2px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: var(--bg-color);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.data-table tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.data-table.compact th,
.data-table.compact td {
    padding: 10px 12px;
    font-size: 0.9rem;
}

.actions-column {
    width: 120px;
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Filters */
.filters-section {
    background-color: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group .form-control,
.filter-group .form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background-color: white;
}

.filter-group .form-control:focus,
.filter-group .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.help-block {
    font-size: 0.8rem;
    color: var(--danger-color);
    margin-top: 4px;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-active {
    background-color: #dcfce7;
    color: #166534;
}

.status-inactive {
    background-color: #f1f5f9;
    color: #64748b;
}

/* Stock Badges */
.stock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
}

.stock-high {
    background-color: #dcfce7;
    color: #166534;
}

.stock-medium {
    background-color: #fef3c7;
    color: #92400e;
}

.stock-low {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Marketplace Badges */
.marketplace-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: white;
}

.mp-linked {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--success-color);
}

.mp-unlinked {
    color: var(--text-light);
}

.mp-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

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

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--text-light);
}

.empty-state p {
    margin-bottom: 20px;
}

.empty-state.small {
    padding: 30px 20px;
}

.empty-state.small i {
    font-size: 2rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-header .close {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 20px;
}

.login-box {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Company Selection */
.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.company-card {
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    transition: all 0.2s;
}

.company-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.company-logo {
    width: 60px;
    height: 60px;
    background-color: var(--bg-color);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.company-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.company-role {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.company-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.company-meta i {
    margin-right: 4px;
}

.create-company {
    text-align: center;
}

/* Marketplace Grid */
.marketplace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.marketplace-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    border-left-width: 4px;
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.2s;
}

.marketplace-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.marketplace-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.marketplace-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.marketplace-info h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.marketplace-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.marketplace-link {
    font-size: 0.85rem;
    font-weight: 500;
}

.marketplace-icon-large {
    width: 50px;
    height: 50px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.marketplace-icon-large img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 120px;
    height: 100px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.quick-action-btn i {
    font-size: 1.5rem;
}

.quick-action-btn span {
    font-size: 0.8rem;
    text-align: center;
}

/* Product Cell */
.product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
    list-style: none;
}

.pagination li a,
.pagination li span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-primary);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
}

.pagination li.active span {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination li a:hover {
    background-color: var(--bg-color);
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

    .sidebar-toggle-mobile {
        display: block;
    }

    .search-bar {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-actions {
        width: 100%;
    }

    .quick-actions {
        justify-content: center;
    }

    .company-grid {
        grid-template-columns: 1fr;
    }

    .marketplace-grid {
        grid-template-columns: 1fr;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 16px;
}

.mt-4 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 4px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 16px;
}

.mb-4 {
    margin-bottom: 24px;
}

/* Icons (using unicode symbols as fallback) */
[class^="icon-"]::before {
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.icon-dashboard::before {
    content: "\1F4CA";
}

.icon-marketplace::before {
    content: "\1F3EA";
}

.icon-products::before {
    content: "\1F4E6";
}

.icon-orders::before {
    content: "\1F4CB";
}

.icon-supply::before {
    content: "\1F69A";
}

.icon-warehouse::before {
    content: "\1F3E2";
}

.icon-analytics::before {
    content: "\1F4C8";
}

.icon-settings::before {
    content: "\2699";
}

.icon-users::before {
    content: "\1F465";
}

.icon-logs::before {
    content: "\1F4DD";
}

.icon-menu::before {
    content: "\2630";
}

.icon-search::before {
    content: "\1F50D";
}

.icon-bell::before {
    content: "\1F514";
}

.icon-user::before {
    content: "\1F464";
}

.icon-building::before {
    content: "\1F3E2";
}

.icon-eye::before {
    content: "\1F441";
}

.icon-edit::before {
    content: "\270F";
}

.icon-trash::before {
    content: "\1F5D1";
}

.icon-plus::before {
    content: "+";
}

.icon-arrow::before {
    content: "\25BC";
}

.icon-arrow-right::before {
    content: "\2192";
}

.icon-check::before {
    content: "\2713";
}

.icon-error::before {
    content: "\2717";
}

.icon-warning::before {
    content: "\26A0";
}

.icon-info::before {
    content: "\2139";
}

.icon-refresh::before {
    content: "\21BB";
}

.icon-list::before {
    content: "\2630";
}

.icon-money::before {
    content: "\1F4B0";
}

.icon-bolt::before {
    content: "\26A1";
}

.icon-profile::before {
    content: "\1F464";
}

.icon-logout::before {
    content: "\2192";
}

.icon-lock::before {
    content: "\1F512";
}

/* ===== Tax info boxes (������ Bootstrap .alert �� ���. ��������� ��������) ===== */
.tax-info-box {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    border-left: 4px solid transparent;
}

.tax-info-box h5 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 600;
}

.tax-info-box p {
    margin: 0;
    font-size: .9rem;
}

.tax-info-box--info {
    background: #e8f4fd;
    border-color: #3b9edd;
    color: #1a5a8a;
}

.tax-info-box--success {
    background: #eafaf1;
    border-color: #2ecc71;
    color: #1a6b3c;
}

.tax-info-box--warning {
    background: #fef9e7;
    border-color: #f39c12;
    color: #7d5a00;
}

.tax-info-box--primary {
    background: #eef2ff;
    border-color: #667eea;
    color: #3730a3;
}

.tax-info-box--light {
    background: #f8f9fa;
    border-color: #dee2e6;
    color: #6c757d;
}

nav.sidebar-menu ul {
    padding-left: 0.5em !important;
}

/* ============================================================
   SIDEBAR — REDESIGNED v2
   ============================================================ */

/* --- Variables override --- */
:root {
    --sb-bg-top:      #0f172a;
    --sb-bg-mid:      #141e30;
    --sb-bg-bot:      #1a2744;
    --sb-accent:      #3b82f6;
    --sb-accent-glow: rgba(59, 130, 246, 0.35);
    --sb-accent2:     #6366f1;
    --sb-text:        rgba(255, 255, 255, 0.55);
    --sb-text-hover:  rgba(255, 255, 255, 0.85);
    --sb-text-active: #ffffff;
    --sb-hover-bg:    rgba(255, 255, 255, 0.05);
    --sb-active-bg:   rgba(59, 130, 246, 0.13);
    --sb-border:      rgba(255, 255, 255, 0.06);
}

/* --- Base sidebar --- */
.sidebar {
    background: linear-gradient(175deg, var(--sb-bg-top) 0%, var(--sb-bg-mid) 45%, var(--sb-bg-bot) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.3);
    overflow-x: hidden;
}

/* Custom scrollbar */
.sidebar::-webkit-scrollbar {
    width: 3px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* --- Logo --- */
.sidebar-header {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid var(--sb-border);
    padding: 0 16px;
}

.sidebar.collapsed .sidebar-header {
    padding: 0 10px;
    justify-content: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.logo-mark {
    width: 30px;
    height: 30px;
    min-width: 30px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.5);
    letter-spacing: -1px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(130deg, #ffffff 30%, rgba(148, 163, 184, 0.9) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
}

.sidebar.collapsed .logo-mark {
    margin: 0 auto;
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.0);
    border: 1px solid transparent;
    border-radius: 7px;
    color: rgba(255, 255, 255, 0.4);
    padding: 5px 7px;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--sb-border);
    color: #fff;
    transform: none;
}

/* --- Section labels --- */
.nav-section-label {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.22);
    padding: 14px 22px 3px;
    user-select: none;
    pointer-events: none;
}

.sidebar.collapsed .nav-section-label {
    display: none;
}

/* --- Nav items reset --- */
.sidebar-menu {
    padding: 4px 0 20px;
}

nav.sidebar-menu ul {
    padding-left: 0 !important;
}

.sidebar-menu li {
    margin: 1px 0;
}

/* --- Nav link base --- */
.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    margin: 0 8px;
    color: var(--sb-text);
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    border-radius: 8px;
    border-left: 3px solid transparent;
    gap: 0;
    font-size: 0.88rem;
}

.sidebar-menu a:hover {
    color: var(--sb-text-hover);
    background: var(--sb-hover-bg);
}

.sidebar-menu li.active > a {
    color: var(--sb-text-active);
    background: var(--sb-active-bg);
    border-left-color: var(--sb-accent);
    font-weight: 500;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.12);
}

/* --- Icons --- */
.sidebar-menu i {
    width: 22px;
    min-width: 22px;
    height: 22px;
    margin-right: 11px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 5px;
    transition: background 0.18s;
}

.sidebar-menu li.active > a i {
    color: #93c5fd;
}

/* Collapsed tooltip (sidebar) */
.sidebar.collapsed .sidebar-menu a {
    margin: 0 6px;
    padding: 10px;
    justify-content: center;
    border-radius: 8px;
    border-left: 3px solid transparent;
}

.sidebar.collapsed .sidebar-menu a::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: #1e293b;
    color: #fff;
    padding: 6px 12px;
    border-radius: 7px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 1001;
    font-size: 0.82rem;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.sidebar.collapsed .sidebar-menu a:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* --- Menu Group (Marketplaces accordion) --- */
.menu-group > .group-toggle {
    color: var(--sb-text);
    font-size: 0.88rem;
    font-weight: 500;
}

.menu-group.open > .group-toggle {
    color: var(--sb-text-hover);
}

.menu-group .group-toggle .icon-arrow {
    margin-left: auto;
    margin-right: 0;
    font-size: 0.52rem;
    opacity: 0.4;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}

.menu-group.open > .group-toggle > .icon-arrow {
    transform: rotate(180deg);
    opacity: 0.7;
}

/* --- Submenu (1st level) --- */
.submenu {
    background: transparent;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-left: 0;
}

.menu-group.open > .submenu {
    max-height: 1200px;
}

.submenu > li > a {
    padding: 7px 14px 7px 42px;
    font-size: 0.855rem;
    color: rgba(255, 255, 255, 0.48);
    border-left: 3px solid transparent;
    border-radius: 8px;
    margin: 0 8px;
}

.submenu > li > a:hover {
    color: rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.045);
}

.submenu > li.active > a {
    color: #fff;
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
    font-weight: 500;
}

/* --- Nested submenus (2nd level, marketplaces) --- */
.menu-group-nested {
    list-style: none;
}

.menu-group-nested > .group-toggle {
    padding: 7px 14px 7px 42px;
    font-size: 0.855rem;
    color: rgba(255, 255, 255, 0.48);
    border-left: 3px solid transparent;
    border-radius: 8px;
    margin: 0 8px;
}

.menu-group-nested > .group-toggle:hover {
    color: rgba(255, 255, 255, 0.82);
    background: rgba(255, 255, 255, 0.045);
}

.menu-group-nested.open > .group-toggle {
    color: rgba(255, 255, 255, 0.8);
}

.menu-group-nested > .group-toggle .icon-arrow {
    font-size: 0.48rem;
    margin-left: auto;
    opacity: 0.4;
}

.submenu-nested {
    background: transparent !important;
}

.submenu-nested a {
    padding: 6px 14px 6px 60px !important;
    font-size: 0.83rem !important;
    color: rgba(255, 255, 255, 0.38) !important;
    border-left: 3px solid transparent;
}

.submenu-nested > li > a:hover {
    color: rgba(255, 255, 255, 0.75) !important;
    background: rgba(255, 255, 255, 0.04) !important;
}

.submenu-nested > li.active > a {
    color: #93c5fd !important;
    background: rgba(59, 130, 246, 0.08) !important;
    border-left-color: rgba(59, 130, 246, 0.45) !important;
}

.submenu-nested a i {
    font-size: 0.75rem;
    margin-right: 7px;
    opacity: 0.45;
    width: 14px;
}

/* --- MP Dots --- */
.mp-icon-small {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
    flex-shrink: 0;
    box-shadow: 0 0 7px currentColor;
    opacity: 0.8;
    transition: opacity 0.18s, box-shadow 0.18s;
}

.submenu > li:hover .mp-icon-small,
.submenu > li.active .mp-icon-small {
    opacity: 1;
    box-shadow: 0 0 10px currentColor;
}

/* --- "Подключить МП" special button --- */
.submenu-add-mp > a {
    color: rgba(99, 102, 241, 0.7) !important;
    border: 1px dashed rgba(99, 102, 241, 0.28) !important;
    background: transparent !important;
    border-radius: 8px !important;
    margin: 3px 8px !important;
    padding: 6px 14px 6px 14px !important;
    font-size: 0.85rem !important;
    transition: all 0.22s ease !important;
    gap: 9px;
}

.submenu-add-mp > a:hover {
    color: rgba(129, 140, 248, 1) !important;
    border-color: rgba(99, 102, 241, 0.55) !important;
    background: rgba(99, 102, 241, 0.07) !important;
}

.submenu-add-mp.active > a {
    color: #a5b4fc !important;
    border-color: rgba(99, 102, 241, 0.5) !important;
    border-style: solid !important;
    background: rgba(99, 102, 241, 0.1) !important;
}

.add-mp-icon {
    width: 20px;
    height: 20px;
    min-width: 20px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    transition: background 0.18s;
    flex-shrink: 0;
}

.submenu-add-mp > a:hover .add-mp-icon {
    background: rgba(99, 102, 241, 0.25);
}

/* ============================================================
   HEADER — REDESIGNED v2
   ============================================================ */

.header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

.search-bar {
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 7px 12px;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    gap: 8px;
}

.search-bar:focus-within {
    background: #fff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.search-bar input {
    background: none;
    font-size: 0.875rem;
    color: #1e293b;
}

.search-bar input::placeholder {
    color: #94a3b8;
}

.search-bar button {
    color: #94a3b8;
    transition: color 0.18s;
}

.search-bar:focus-within button {
    color: #3b82f6;
}

.company-selector-toggle {
    border-radius: 9px;
    font-size: 0.855rem;
    padding: 6px 11px;
    gap: 7px;
    transition: all 0.18s;
}

.company-selector-toggle:hover,
.company-selector.open .company-selector-toggle {
    background: #f1f5f9;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.09);
}

.notifications-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    transition: background 0.18s, color 0.18s;
    color: #64748b;
}

.notifications-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.notifications-btn .badge {
    font-size: 0.66rem;
    padding: 1px 5px;
    top: -4px;
    right: -4px;
    border-radius: 8px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px #fff;
}

.dropdown-toggle {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
    border: 2px solid #e2e8f0;
    color: #475569;
    transition: all 0.18s;
}

.dropdown-toggle:hover {
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    border-color: #93c5fd;
    color: #1d4ed8;
}

.dropdown-menu {
    border-radius: 11px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 4px;
    margin-top: 6px;
}

.dropdown-menu a {
    border-radius: 7px;
    padding: 9px 14px;
    font-size: 0.875rem;
    transition: background 0.15s;
}

.dropdown-menu a:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.dropdown-menu .divider {
    margin: 4px 6px;
}

.company-dropdown-menu {
    border-radius: 11px;
    border: 1px solid rgba(0, 0, 0, 0.07);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    min-width: 260px;
}

.company-dropdown-header {
    padding: 10px 14px 8px;
    border-bottom: 1px solid #f1f5f9;
}

.company-dropdown-item {
    padding: 9px 14px;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;
}

.company-dropdown-item:last-child {
    border-bottom: none;
    border-bottom-left-radius: 9px;
    border-bottom-right-radius: 9px;
}

.company-dropdown-item:hover {
    background: #f8fafc;
}

.company-dropdown-item.active {
    background: #eff6ff;
}

.company-dropdown-name {
    font-size: 0.875rem;
}

/* Username styling */
.username {
    font-size: 0.855rem;
    font-weight: 600;
    color: #1e293b;
}

.user-role {
    font-size: 0.72rem;
    color: #94a3b8;
}

/* ============================================================
   MISC SIDEBAR FIXES
   ============================================================ */

/* Smooth max-height transition for accordion */
.submenu {
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-group.open > .submenu {
    max-height: 1500px;
}

