/* ========================================
   BRIS Design System - CSS Variables
   ======================================== */
:root {
    /* Brand Colors */
    --bris-primary: #2c6bbf;
    --bris-primary-dark: hwb(214 11% 24%);
    --bris-secondary: #2f3e4e;
    --bris-bg: #f5f7fa;
    --bris-surface: #ffffff;
    --bris-border: #d9e1ea;
    --bris-text: #243447;
    --bris-text-muted: #6b7a89;
    --bris-success: #23a55a;
    --bris-warning: #f4b400;
    --bris-danger: #e55353;
    --bris-info: #4da3ff;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.08);

    /* Typography */
    --font-main: "Segoe UI", "Inter", Arial, sans-serif;

    /* Logo */
    --site-logo-width: 154px;
    --site-logo-height: 42px;
    
    /* Legacy support */
    --bris-dark: var(--bris-primary);
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bris-bg);
    color: var(--bris-text);
    line-height: 1.6;
    font-size: 14px;
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--bris-text);
    line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* ========================================
   Buttons - Unified System
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    gap: 6px;
}

/* Hover эффект для всех кнопок */
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* Активное нажатие */
.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-primary {
    background-color: var(--bris-primary);
    color: #ffffff;
}

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

.btn-secondary {
    background-color: var(--bris-secondary);
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #1f2d3a;
    filter: brightness(0.95);
}

.btn-success {
    background-color: var(--bris-success);
    color: #ffffff;
}

.btn-success:hover {
    background-color: #1e8e4a;
    filter: brightness(0.9);
}

.btn-danger {
    background-color: var(--bris-danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #d43f3f;
    filter: brightness(0.9);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ========================================
   Forms - Unified Inputs
   ======================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--bris-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.9rem;
    color: var(--bris-text);
    background-color: var(--bris-surface);
    transition: all 0.2s ease;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--bris-primary);
    box-shadow: 0 0 0 3px rgba(44, 107, 191, 0.1);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7a89' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ========================================
   Tables - Unified System
   ======================================== */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bris-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

thead {
    background-color: var(--bris-primary);
    color: #ffffff;
}

th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 2px solid rgba(255, 255, 255, 0.2);
}

th:last-child {
    border-right: none;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--bris-border);
    font-size: 0.9rem;
}

tbody tr:hover {
    background-color: rgba(44, 107, 191, 0.04);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   Card Header - Unified Block Headers
   ======================================== */
.card-header {
    background-color: var(--bris-primary);
    color: #ffffff;
    font-weight: 600;
    padding: 14px 20px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

/* ========================================
   Badges - Unified Status System
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background-color: rgba(35, 165, 90, 0.1);
    color: var(--bris-success);
}

.badge-warning {
    background-color: rgba(244, 180, 0, 0.1);
    color: var(--bris-warning);
}

.badge-info {
    background-color: rgba(77, 163, 255, 0.1);
    color: var(--bris-info);
}

.badge-danger {
    background-color: rgba(229, 83, 83, 0.1);
    color: var(--bris-danger);
}

.badge-secondary {
    background-color: rgba(47, 62, 78, 0.1);
    color: var(--bris-secondary);
}

/* ========================================
   Layout & Spacing
   ======================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.card {
    background-color: var(--bris-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
}

.section {
    margin-bottom: 30px;
}

/* ========================================
   Legacy Support - Keep existing styles working
   ======================================== */

/* === Alerts === */
.alert {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 0.95rem;
    z-index: 200;
    transition: opacity 0.3s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.alert-error {
    background-color: #e74c3c;
    color: #fff;
}

.alert-success {
    background-color: #2ecc71;
    color: #fff;
}

/* === Header === */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 15px 30px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    z-index: 100;
}

.logo {
    width: var(--site-logo-width);
    height: var(--site-logo-height);
    flex: 0 0 var(--site-logo-width);
    background-image: url("../logo_VELORIA.png");
    background-position: left center;
    background-repeat: no-repeat;
    background-size: contain;
}

.mobile-nav-toggle {
    display: none;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    padding: 6px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 3px;
}

.mobile-nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: #495057;
}

/* === Nav Links === */
.nav-links {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex: 1;
    align-items: center;
    min-width: 0;
    max-width: 100%;
}

/* Unified Navigation Buttons */
.nav-btn {
    padding: 8px 16px;
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    line-height: 1;
}

.nav-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
    transform: translateY(-1px);
}

.nav-btn.active {
    background: #3498db;
    color: #fff;
    border-color: #3498db;
}

.nav-btn.active:hover {
    background: #2980b9;
    border-color: #2980b9;
}

.cart-count-badge {
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #e74c3c;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0 5px;
    line-height: 1;
}

.cart-count-badge.empty {
    background: #7f8c8d;
}

/* === Auth Button === */
.auth-container {
    position: relative;
    margin-left: 10px;
}

.auth-toggle {
    padding: 8px 20px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.3s;
}

.auth-toggle:hover {
    background-color: #2980b9;
}

/* === User Info (logged in) === */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

@media (min-width: 769px) and (max-width: 1480px) {
    .nav-links {
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
    }

    .auth-container {
        flex: 0 1 auto;
        min-width: 0;
    }

    .user-info {
        min-width: 0;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-end;
        gap: 8px;
        scrollbar-width: thin;
    }
}

.user-name {
    font-weight: bold;
    color: #2c3e50;
}

.btn-logout {
    padding: 8px 16px;
    background-color: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background-color: #c0392b;
}

/* Specific button styles */
.btn-manager {
    margin-right: 10px;
}

.btn-toggle-prices {
    margin-right: 10px;
}

.btn-logout {
    background: #f39c12;
    border-color: #f39c12;
    color: #fff;
}

.btn-logout:hover {
    background: #e67e22;
    border-color: #e67e22;
    color: #fff;
}

.btn-admin-users {
    padding: 8px 16px;
    background-color: #9b59b6;
    color: #fff;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-admin-users:hover {
    background-color: #8e44ad;
}

.btn-feedback {
    background: #16a085;
    border-color: #16a085;
    color: #fff;
}

.btn-feedback:hover {
    background: #138d75;
    border-color: #138d75;
    color: #fff;
}

.filters-drawer {
    margin-bottom: 15px;
}

.filters-drawer summary {
    list-style: none;
}

.filters-drawer summary::-webkit-details-marker {
    display: none;
}

.filters-toggle {
    display: none;
}

.filters-drawer.is-collapsible .filters-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #dde5ec;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    color: #2c3e50;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.filters-drawer.is-collapsible .filters-toggle::after {
    content: "Показать";
    color: #6c7a89;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.filters-drawer.is-collapsible[open] > .filters-toggle::after {
    content: "Скрыть";
}

.filters-drawer.is-collapsible .filters-drawer__body {
    padding-top: 10px;
}

.filters-drawer:not([open]) .filters-drawer__body {
    display: block;
}

.filters-drawer.is-collapsible:not([open]) .filters-drawer__body {
    display: none;
}

.filters-drawer__body .filters-form {
    margin-bottom: 0;
}

/* === Auth Dropdown === */
.auth-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 300px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.auth-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* === Auth Tabs === */
.auth-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #999;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

.tab-btn:hover {
    color: #3498db;
}

/* === Auth Forms === */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-dropdown input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s;
}

.auth-dropdown input:focus {
    border-color: #3498db;
}

.btn-login {
    width: 100%;
    padding: 10px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

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

.forgot-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    color: #999;
    font-size: 0.85rem;
    text-decoration: none;
}

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

/* === Main Content === */
main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

p {
    font-size: 1.1rem;
    color: #666;
}

/* === Manager Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(3px);
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid #eee;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px;
}

.manager-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    border-left: 4px solid #3498db;
}

.manager-name {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 12px;
}

.manager-detail {
    color: #555;
    margin: 8px 0;
    font-size: 0.95rem;
}

.contact-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.95rem;
    font-weight: 500;
}

.contact-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.contact-text {
    flex: 1;
}

.contact-email {
    background: #3498db;
    color: #fff;
}

.contact-email:hover {
    background: #2980b9;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.contact-messenger {
    background: #27ae60;
    color: #fff;
}

.contact-messenger:hover {
    background: #229954;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.contact-complaint {
    background: #95a5a6;
    color: #fff;
    border: 1px solid #7f8c8d;
}

.contact-complaint:hover {
    background: #7f8c8d;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(127, 140, 141, 0.3);
}

@media (max-width: 768px) {
    :root {
        --site-logo-width: 104px;
        --site-logo-height: 28px;
    }

    body {
        font-size: 13px;
    }

    h1 {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.15rem;
    }

    h3 {
        font-size: 1rem;
    }

    h4 {
        font-size: 0.92rem;
    }

    header {
        position: static;
        display: grid;
        grid-template-columns: calc(var(--site-logo-width) / 2) auto minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 6px;
        row-gap: 6px;
        padding: 8px 8px;
        overflow: visible;
    }

    .logo {
        width: var(--site-logo-width);
        height: var(--site-logo-height);
        flex-basis: var(--site-logo-width);
        flex-shrink: 0;
        grid-column: 1;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        grid-column: 2;
        grid-row: 1;
        width: 44px;
        height: 22px;
        padding: 4px;
        border-radius: 4px;
        flex-shrink: 0;
    }

    .nav-links {
        grid-column: 1 / -1;
        grid-row: 2;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        min-width: 0;
        padding: 8px;
        background: #fff;
        border: 1px solid #dde5ec;
        border-radius: 8px;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    }

    header.nav-open .nav-links {
        display: flex;
    }

    .auth-container {
        grid-column: 4;
        width: auto;
        margin-left: 0;
        flex: 0 0 auto;
        min-width: 0;
    }

    .user-info {
        width: auto;
        flex-wrap: nowrap;
        gap: 6px;
        justify-content: flex-start;
        padding-left: 2px;
    }

    .user-name {
        font-size: 0.62rem;
        padding: 0 2px;
        white-space: nowrap;
    }

    .nav-btn,
    .btn-logout,
    .auth-toggle {
        height: 22px;
        padding: 2px 5px;
        font-size: 0.62rem;
        gap: 3px;
        border-radius: 4px;
        flex-shrink: 0;
    }

    .cart-count-badge {
        min-width: 14px;
        height: 14px;
        padding: 0 3px;
        font-size: 0.56rem;
    }

    .auth-dropdown {
        top: calc(100% + 6px);
        right: 0;
        width: min(300px, calc(100vw - 16px));
        max-width: calc(100vw - 16px);
        z-index: 300;
    }

    .filters-drawer {
        margin-bottom: 12px;
    }

    .filters-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 8px 10px;
        background: #fff;
        border: 1px solid #dde5ec;
        border-radius: 10px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
        color: #2c3e50;
        font-size: 0.82rem;
        font-weight: 700;
        cursor: pointer;
    }

    .filters-toggle::after {
        content: "Показать";
        color: #6c7a89;
        font-size: 0.78rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .filters-drawer[open] > .filters-toggle::after {
        content: "Скрыть";
    }

    .filters-drawer__body {
        padding-top: 10px;
    }

    .filters-drawer:not([open]) .filters-drawer__body {
        display: none;
    }

    .modal-content {
        width: calc(100% - 32px);
        margin: 16px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 14px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .btn-manager {
        font-size: 0.78rem;
        padding: 5px 10px;
    }
}
