* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header styles */
.header {
    background-color: #fff;
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}

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

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Main content */
.main-content {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.centered-text {
    text-align: center;
}

.centered-text h2 {
    font-size: 32px;
    color: #7f8c8d;
}

/* Auth pages */
.auth-container {
    max-width: 400px;
    margin: 50px auto;
    background-color: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-container h2 {
    margin-bottom: 30px;
    text-align: center;
    color: #2c3e50;
}

.auth-form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
}

.auth-links a {
    color: #3498db;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.alert {
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert-error {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background-color: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.error {
    color: #c33;
    font-size: 12px;
    margin-top: 5px;
}

/* Admin panel */
.admin-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: max-content !important;
    min-width: max-content !important;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000 !important;
    padding-right: 20px !important;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
    /* Место для кнопки закрытия */
}

.sidebar.hidden {
    transform: translateX(-100%);
}

/* Убеждаемся, что все элементы sidebar не переносятся */
.sidebar .nav-link,
.sidebar .submenu-link,
.sidebar-header {
    white-space: nowrap !important;
}

.sidebar .submenu {
    white-space: normal !important;
}

.sidebar-header {
    padding: 20px 20px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #2c3e50;
    position: relative;
}

.sidebar-header .logo {
    color: #ffffff;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: block;
    padding: 14px 20px 14px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: #3498db;
    padding-left: 24px;
}

.nav-link.active,
a.nav-link.active {
    background-color: rgba(52, 152, 219, 0.15);
    border-left-color: #3498db;
    color: #3498db;
    font-weight: 700;
}

.nav-item.has-submenu .nav-link {
    font-weight: 700;
    cursor: pointer;
    position: relative;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.nav-item.has-submenu .nav-link::after {
    content: '▶';
    position: absolute;
    right: 20px;
    transition: transform 0.3s ease;
    font-size: 11px;
    opacity: 0.7;
}

.nav-item.has-submenu.active .nav-link::after {
    transform: rotate(90deg);
    opacity: 1;
}

.nav-item.has-submenu.active .nav-link {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: #3498db;
}

.submenu {
    list-style: none;
    background-color: #2c3e50;
    padding-left: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    border-left: 3px solid transparent;
}

.nav-item.has-submenu.active .submenu {
    max-height: 500px;
    transition: max-height 0.3s ease-in;
    border-left-color: #3498db;
}

/* Отключаем анимацию при загрузке страницы */
body.menu-loading .submenu {
    transition: none !important;
}

body.menu-loading .nav-item.has-submenu.active .submenu {
    transition: none !important;
}

.submenu-link {
    display: block;
    padding: 12px 20px 12px 48px;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    position: relative;
}

.submenu-link::before {
    content: '•';
    position: absolute;
    left: 32px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
}

.submenu-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    padding-left: 52px;
}

.submenu-link:hover::before {
    color: #3498db;
}

.submenu-link.active,
a.submenu-link.active {
    background-color: rgba(52, 152, 219, 0.15) !important;
    color: #3498db !important;
    font-weight: 600 !important;
    border-left: 3px solid #3498db;
    padding-left: 45px;
}

.submenu-link.active::before,
a.submenu-link.active::before {
    color: #3498db;
    left: 29px;
}

.admin-main {
    margin-left: 250px;
    flex: 1;
    background-color: #f5f5f5;
    transition: margin-left 0.3s ease;
}

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

/* Кнопка для показа/скрытия sidebar */
.sidebar-toggle-btn {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001 !important;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 16px 10px;
    cursor: pointer;
    font-size: 22px;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
    display: none;
    line-height: 1;
    font-weight: 600;
}

.sidebar-toggle-btn:hover {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    padding-left: 14px;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-50%) translateX(2px);
}

.sidebar-toggle-btn.visible {
    display: block !important;
}

/* Кнопка для скрытия sidebar (внизу слева экрана) */
.sidebar-close-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #2c3e50;
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 1002 !important;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    width: 44px;
    height: 44px;
}

.sidebar-close-btn:hover {
    background-color: #34495e;
    transform: translateX(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.admin-header {
    background-color: #fff;
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

.admin-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header-content h2 {
    color: #2c3e50;
}

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

.admin-content {
    padding: 0;
    background-color: #fff;
    margin: 0;
    width: 100%;
    max-width: 100%;
}

/* Page switcher */
.page-switcher {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 20px 30px 0;
    border-bottom: 2px solid #e0e0e0;
}

.switcher-btn {
    padding: 12px 24px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
}

.switcher-btn:hover {
    color: #3498db;
    border-bottom-color: #bdc3c7;
}

.switcher-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: 600;
}

.orders-content {
    margin-top: 0;
    padding: 0;
    width: 100%;
}

/* Orders table */
.orders-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
}

.orders-table thead {
    background-color: #f8f9fa;
}

.orders-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
}

.orders-table td {
    padding: 12px;
    border-bottom: 1px solid #dee2e6;
}

.orders-table tbody tr:hover {
    background-color: #f8f9fa;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-new {
    background-color: #dc5f59;
    color: white;
}

.status-accepted,
.status-in-work {
    background-color: #85c5e0;
    color: white;
}

.status-dispatched {
    background-color: #3a9fc9;
    color: white;
}

.status-delivered {
    background-color: #5cb85c;
    color: white;
}

.status-cancelled {
    background-color: #d9534f;
    color: white;
}

.orders-info {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
}

.no-orders {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

.no-orders p {
    font-size: 18px;
}

/* Badge для счетчика */
.badge {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 8px;
    background-color: #e74c3c;
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* Круглый бейдж для новых заказов */
.new-orders-badge-round {
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 11px !important;
    font-weight: bold !important;
    line-height: 1 !important;
}

/* Для двузначных чисел делаем овальным */
.new-orders-badge-round[style*="width: auto"] {
    border-radius: 10px !important;
    padding: 0 6px !important;
}

.submenu-link .badge {
    margin-left: auto;
    float: right;
}

.switcher-btn .badge {
    margin-left: 8px;
    background-color: #e74c3c;
}

/* Кнопка "Отметить просмотренным" */
.btn-mark-viewed {
    padding: 6px 12px;
    background-color: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.btn-mark-viewed:hover {
    background-color: #4cae4c;
}

.btn-mark-viewed:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.order-row {
    transition: opacity 0.3s;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .admin-main {
        margin-left: 200px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }
}

/* Баннер уведомления о новых заказах */
.new-orders-banner {
    background: #dc3545;
    color: white;
    padding: 12px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease-out;
}

.new-orders-banner a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    display: block;
    transition: opacity 0.2s;
}

.new-orders-banner a:hover {
    opacity: 0.9;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Overlay для индикатора загрузки */
.page-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-in;
}

.page-loading-spinner {
    text-align: center;
    color: white;
}

.page-loading-spinner p {
    margin-top: 20px;
    font-size: 16px;
    font-weight: 500;
}

/* Спиннер загрузки */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}