/* --- Прелоадер --- */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f5f5f7; /* Тот же фон, что и у сайта */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

#preloader.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--accent);
    animation: spin 1s ease infinite;
}

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


/* --- Coffee Shop Style v9.0 (Float-based) --- */
:root {
    --background: #f5f5f7;
    --card-background: rgba(255, 255, 255, 0.7);
    --text-primary: #000000;
    --text-secondary: #333333;
    --accent: #007aff; /* Синий цвет для акцентов */
    --danger: #ff3b30; /* Красный для удаления */
    --coffee-brown: #B0B0B0;
}

html {
    scroll-behavior: smooth;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}
body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    color: var(--text-primary);
    background-image: url("fone.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.no-select {
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none;     /* IE 10+ */
    user-select: none;         /* Standard syntax */
}

/* --- Липкая навигация --- */
.category-navbar { 
    position: sticky; 
    top: 0; 
    background: transparent;
    padding: 10px 15px; 
    border-bottom: none;
    display: flex; 
    overflow-x: auto; 
    z-index: 10; 
}
.category-navbar button { 
    padding: 8px 16px; 
    margin-right: 10px; 
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: transparent;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
    border-radius: 20px; 
    font-size: 0.9em; 
    font-weight: 500; 
    cursor: pointer; 
    flex-shrink: 0; 
}

/* --- ОСНОВНАЯ ВЕРСТКА с FLOAT --- */
#product-catalog { padding: 15px; }

.products-grid {
    margin: 0 -1.5%;
}
.products-grid::after {
    content: "";
    display: table;
    clear: both;
}

.category-title {
    width: 100%;
    float: left;
    padding: 0 1.5%;
    font-size: 1.5em;
    font-weight: 700;
    margin: 20px 0 5px 0;
    color: white;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    scroll-margin-top: 80px; /* Отступ для скролла */
}

.product-card {
    float: left;
    width: 30.33%;
    margin: 0 1.5% 15px 1.5%;
    background: var(--card-background);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: pointer;
    border: none;
}
.product-card img { width: 100%; height: 110px; object-fit: cover; display: block; }
.product-card .product-info {
    background-color: var(--coffee-brown);
    padding: 10px;
    color: white;
}
.product-card .name { font-weight: 500; font-size: 0.9em; margin: 0 0 4px 0; }
.product-card .price { font-size: 0.85em; color: white; margin: 0; }
.product-card .description { display: none; }


.product-card, .category-navbar button, .checkout-button, .quantity-selector button {
    transition: all 0.3s ease;
}
.admin-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.admin-container h1, .admin-container h2, .admin-container h3 {
    color: var(--text-primary);
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
    margin-top: 0;
}

.admin-section {
    margin-bottom: 40px;
}

/* --- Forms --- */
#item-form, #category-form, #modifier-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 12px;
    margin-bottom: 20px;
}

#item-form h3 {
    margin: 0;
    padding: 0;
    border: none;
}

#item-form input[type="text"],
#item-form input[type="number"],
#item-form textarea,
#item-form select,
#category-form input[type="text"],
#modifier-form input[type="text"],
#modifier-form input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    box-sizing: border-box; /* Important */
}

#item-form textarea {
    min-height: 100px;
    resize: vertical;
}

#item-form button, #category-form button, #modifier-form button {
    padding: 12px 20px;
    border: none;
    background-color: #007aff;
    color: white;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    align-self: flex-start; /* Button doesn't stretch */
}

/* --- Categories & Items List --- */
#categories-container, #items-container, #modifiers-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.category-item, .item-admin-card {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.item-admin-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.category-item span, .item-admin-card p {
    margin: 0 0 8px 0;
}

.category-item div, .item-admin-card div {
    margin-top: 10px;
}

.category-item button, .item-admin-card button {
    padding: 8px 12px;
    margin-right: 5px;
    border: 1px solid #ddd;
    background-color: #f0f0f0;
    border-radius: 6px;
    cursor: pointer;
}

.item-admin-card button:first-of-type {
    background-color: #e0f7ff;
}


/* --- Toast Notification --- */
.toast-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 25px;
    border-radius: 25px;
    background-color: #333;
    color: white;
    font-size: 1em;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}

.toast-notification.show {
    opacity: 1;
    bottom: 30px;
}


/* --- Основные стили --- */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    background-color: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
}

.screen { display: none; flex-direction: column; min-height: 100vh; }
.screen.active { display: flex; }
#catalog-screen header { padding: 15px; }

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

.header-top-user-controls {
    display: flex;
    align-items: center;
}

#account-icon {
    font-size: 1.5em;
    text-decoration: none;
    color: white;
}

.shop-location { 
    font-size: 0.9em; 
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
    margin: 0 0 5px 0; 
}
.greeting { 
    font-size: 1.8em; 
    font-weight: 700; 
    margin: 0; 
    color: white;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}
.modal-screen {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 100%;
    background-color: var(--coffee-brown);
    transition: top 0.4s ease-in-out;
    z-index: 100;
    display: flex;
    flex-direction: column;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.modal-screen.visible { top: 10vh; }
.modal-header { position: relative; height: 30vh; flex-shrink: 0; }
.modal-header img { width: 100%; height: 100%; object-fit: cover; border-top-left-radius: 20px; border-top-right-radius: 20px; }
.modal-close-btn { position: absolute; top: 15px; right: 15px; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(0,0,0,0.4); color: white; font-size: 1.2em; cursor: pointer; }

.modal-content { 
    padding: 20px 15px; 
    flex-grow: 1; 
    overflow-y: auto; 
    color: white; 
    display: flex;
    flex-direction: column;
}

.modal-title { font-size: 1.8em; font-weight: 700; margin: 0 0 10px 0; }
.modal-description { color: rgba(255, 255, 255, 0.8); margin-bottom: 20px; }

/* Стили для вкладок */
.modifier-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.modifier-tab-btn {
    flex-grow: 0; /* Do not grow */
    padding: 0; /* Remove padding */
    border: none; /* Remove border */
    background: transparent;
    color: rgba(255,255,255,0.7);
    font-size: 1.1em; /* Increase font size */
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent; /* Underline for active state */
    margin-right: 20px; /* Add space between tabs */
}

.modifier-tab-btn.active {
    color: white;
    font-weight: 700;
    border-bottom-color: white; /* White underline for active tab */
}

.modifier-tab-content { display: none; }
.modifier-tab-content.active { display: block; }
.modifier-placeholder { color: rgba(255,255,255,0.6); text-align: center; padding: 20px; }

.options-group .group-name { font-size: 1.1em; font-weight: 700; margin: 20px 0 10px 0; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 5px; }
.options-buttons { 
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px; 
}

.options-buttons button {
    padding: 12px;
    border: 1px solid black;
    background: white;
    color: black;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.options-buttons button .mod-price {
    color: #555;
    margin-left: 5px;
}

.options-buttons button.selected {
    border-color: #333;
    background: #333;
    color: white;
}

.options-buttons button.selected .mod-price {
    color: #eee;
}

.modal-footer { 
    padding: 20px 15px; 
    border-top: none; 
    display: flex; 
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
    background-color: var(--coffee-brown);
    flex-shrink: 0;
}
.quantity-selector { display: flex; align-items: center; gap: 15px; font-size: 1.2em; font-weight: 500; justify-content: center; }
.quantity-selector button { width: 35px; height: 35px; border-radius: 50%; border: none; background: rgba(255,255,255,0.2); font-size: 1.5em; color: white; cursor: pointer; }
.checkout-button.add-to-cart-btn {
    padding: 18px;
    font-size: 1.1em;
    background-color: #FFFFFF;
    color: #000000;
    border: 1px solid black;
}

.modal-back-btn {
    background: white;
    border: 1px solid black;
    color: black;
    font-size: 1em;
    cursor: pointer;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
}

/* --- Стили для плавающей кнопки корзины --- */
#cart-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--accent);
    color: white;
    padding: 15px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.3s, opacity 0.3s;
    z-index: 99;
}

#cart-fab.cart-fab-hidden {
    transform: scale(0);
    opacity: 0;
}

#cart-fab-count {
    background-color: white;
    color: var(--accent);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
}

/* --- Стили для экрана корзины --- */
.screen-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center; /* Center the title */
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); /* Lighter border for dark bg */
    flex-shrink: 0;
}

.screen-header h2 {
    margin: 0; /* Remove auto margin */
    color: white;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

#back-to-catalog-btn {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px; /* Smaller, more compact */
    font-weight: bold;
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
}

#cart-items-container {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 10px; /* Slightly reduced gap */
    margin-bottom: 15px;
    background: var(--card-background);
    padding: 10px;
    border-radius: 12px;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.cart-item-details {
    flex-grow: 1;
    min-width: 0; /* Allow details to shrink */
}

.cart-item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-mods {
    font-size: 0.85em;
    color: var(--text-secondary);
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-quantity {
    font-weight: 500;
}

.cart-item-price {
    font-weight: 700;
    font-size: 1.1em;
    flex-shrink: 0; /* Prevent wrapping */
    padding-left: 10px;
}

.cart-item-quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* Prevent wrapping */
}

.cart-item-quantity-controls button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    background: #f9f9f9;
    font-size: 1.2em;
    cursor: pointer;
}

.cart-item-quantity-display {
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.cart-item-remove {
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--danger);
    cursor: pointer;
    flex-shrink: 0; /* Prevent wrapping */
    padding: 0 5px;
}

/* --- Cart Screen Enhancements --- */
#cart-screen {
    /* The background is now transparent to show the body background */
    background-color: transparent;
}

.order-comment-section {
    margin-bottom: 15px;
}

.order-comment-section label {
    display: block;
    font-size: 1em;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary); /* This is inside the white footer, so it's ok */
}

#order-comment {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-family: 'Montserrat', sans-serif;
    font-size: 1em;
    resize: vertical;
    background-color: #fff;
}

#cart-screen footer {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
    background-color: #ffffff; /* Solid background for footer */
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    margin-top: auto; /* Push footer to the bottom */
    flex-shrink: 0;
}

.cart-total-section {
    display: flex;
    justify-content: space-between;
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 15px;
}

.confirmation-screen {
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
}

.confirmation-screen h2 {
    font-size: 2em;
    margin-bottom: 10px;
}

.confirmation-screen p {
    font-size: 1.2em;
    margin-bottom: 30px;
}

#toast-container {
    position: fixed;
    bottom: 90px; /* Выше плавающей кнопки корзины */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}





/* --- New Admin Panel Styles --- */
.admin-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #f9f9f9;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.admin-header h1 {
    margin: 0;
    font-size: 1.8em;
}

.admin-actions .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    margin-left: 10px;
}

.btn-primary { background-color: #007aff; color: white; }
.btn-success { background-color: #34c759; color: white; }
.btn-secondary { background-color: #e0e0e0; color: #333; }
.btn-danger { background-color: var(--danger); color: white; }

.admin-grid {
    margin: 0 -1.5%;
}
.admin-grid::after {
    content: "";
    display: table;
    clear: both;
}

.item-card {
    float: left;
    width: 30.33%;
    margin: 0 1.5% 15px 1.5%;
    background: var(--card-background);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: grab;
    border: none;
    position: relative; /* For actions overlay */
}

.item-card:active {
    cursor: grabbing;
}

.item-card .item-card-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    padding: 5px;
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.btn-icon img {
    width: 20px;
    height: 20px;
}

/* SortableJS helper classes */
.sortable-ghost {
    opacity: 0.4;
    background: #c8ebfb;
}
.sortable-chosen {
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.modal-overlay .modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh; /* Ограничение высоты */
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    flex-shrink: 0; /* Заголовок не сжимается */
}

#item-form, .tab-content {
    overflow-y: auto; /* Включаем прокрутку для контента */
    padding-right: 15px; /* Отступ для полосы прокрутки */
}

#item-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#item-form input, #item-form textarea, #item-form select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    box-sizing: border-box;
}

#item-form textarea {
    min-height: 120px;
    resize: vertical;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    flex-shrink: 0; /* Кнопки не сжимаются */
}

/* --- Styles for NEW Settings Modal --- */

.list-container {
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

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

.list-item span {
    font-weight: 500;
}

.item-actions .btn {
    margin-left: 8px;
}

.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
}

.checkbox-list label {
    display: block;
    margin-bottom: 10px;
    cursor: pointer;
}

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

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

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
}

/* --- Стили для вкладки Администрирование --- */

.modal-content.wide {
    max-width: 800px;
}

.modal-header-tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.modal-header-tabs .tab-link {
    padding: 10px 5px;
    margin-bottom: -1px; /* Aligns with the border */
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1.2em;
    color: #000000;
}

.list-item {
    color: #000000;
}

.modal-header-tabs .tab-link.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#add-category-btn {
    font-size: 1.5em;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    border-radius: 50%;
}

.btn-small { 
    padding: 5px 10px;
    font-size: 0.9em;
}

.form-actions-split {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.inline-form {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.inline-form input {
    flex-grow: 1;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    background-color: #f9f9f9;
    margin-bottom: 10px;
}

.category-list-item {
    cursor: pointer;
}

.category-list-item.active {
    background-color: #e0e0e0;
    font-weight: bold;
}

#modifiers-list .list-item {
    cursor: grab;
}

#modifiers-list .list-item > span {
    flex-basis: 70%;
}

#modifier-form {
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 12px;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#modifier-form h4 {
    margin: 0;
}

.category-section {
    background-color: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 20px;
    box-shadow: none;
}

.category-section > div[id^="category-"] {
    scroll-margin-top: 80px; /* Отступ для скролла */
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: grab;
}

.category-header:active {
    cursor: grabbing;
}

.category-ghost {
    opacity: 0.5;
    background: #e0e0e0;
}

.category-rename-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    font-size: 1em;
    padding: 5px;
}
.category-rename-input:focus {
    outline: none;
    background: #eef;
    border-radius: 4px;
}

.filters-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-filter {
    padding: 8px 16px;
    border: 1px solid #e0e0e0;
    background: #f9f9f9;
    color: #333;
    border-radius: 20px;
    cursor: pointer;
}

.btn-filter.active {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.categories-settings-layout {
    display: flex;
    gap: 20px;
}

.categories-column {
    flex: 1;
    border-right: 1px solid #e0e0e0;
    padding-right: 20px;
}

.category-editor-column {
    flex: 2;
}

#category-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#category-modifiers-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    padding: 10px;
    border-radius: 8px;
}

#category-modifiers-list label {
    display: block;
    margin-bottom: 8px;
}

/* --- Стили для вкладки Администрирование --- */
#broadcast-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#broadcast-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: vertical;
}

#users-list {
    max-height: 400px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    background-color: #f9f9f9;
    margin-bottom: 10px;
}

.user-info {
    font-size: 0.9em;
}

.user-info span {
    display: block;
}

.user-info .username {
    font-weight: bold;
}

.user-actions .btn {
    padding: 5px 10px;
    font-size: 0.8em;
}

/* --- Стили для личного кабинета и истории заказов --- */
body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    color: var(--text-primary);
    background-image: url("fone.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: rgba(28, 28, 30, 0.8); /* Полупрозрачный фон */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-height: 100vh;
}

#no-orders-message {
    text-align: center;
    padding: 50px 20px;
    color: #fff;
}

#no-orders-message p {
    font-size: 1.2em;
    margin-bottom: 25px;
}

#no-orders-message .btn {
    background-color: var(--accent);
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s;
}

#no-orders-message .btn:hover {
    background-color: #0056b3;
}

.header {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #1c1c1e;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid #3a3a3a;
}

.back-button {
    margin-right: 15px;
}

.header h1 {
    margin: 0;
    font-size: 1.2em;
    color: white;
    flex-grow: 1;
    text-align: center;
    transform: translateX(-24px); /* Смещаем для центрирования, компенсируя кнопку */
}


#user-info {
    padding: 20px 15px;
    text-align: center;
}

#user-photo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    margin-bottom: 15px;
    box-shadow: 0 0 15px rgba(0, 122, 255, 0.5);
}

#username {
    font-size: 1.6em;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

#order-history {
    padding: 20px 15px;
}

#order-history-list {
    display: grid;
    gap: 20px;
}

.order-card {
    background-color: #2c2c2e;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #3a3a3a;
}

.order-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #444;
}

.order-card-id {
    font-size: 1.1em;
    font-weight: bold;
    color: #fff;
}

.order-card-date {
    font-size: 0.9em;
    color: #aaa;
}

.order-card-items {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.order-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #3a3a3a;
}
.order-item:last-child {
    border-bottom: none;
}

.order-item-image {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    margin-right: 15px;
    object-fit: cover;
}

.order-item-details {
    flex-grow: 1;
}

.order-item-name {
    font-weight: 600;
    color: #eee;
    margin: 0 0 5px 0;
}

.order-item-mods {
    font-size: 0.85em;
    color: #aaa;
    list-style: none;
    padding: 0;
    margin: 0;
}

.order-item-price {
    font-size: 1.1em;
    font-weight: bold;
    color: #fff;
    text-align: right;
}





.error-message {
    text-align: center;
    padding: 20px;
    color: var(--danger);
}

/* --- АДАПТИВНЫЕ СТИЛИ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ --- */
@media (max-width: 768px) {

    /* --- Общие изменения --- */
    body {
        -webkit-text-size-adjust: 100%; /* Предотвращает авто-увеличение шрифта в Safari */
    }

    .admin-container, #product-catalog {
        padding: 10px; /* Уменьшаем отступы на мобильных */
    }

    /* --- Админ-панель --- */
    .admin-header {
        position: relative; /* Добавляем для z-index */
        z-index: 10; /* Поднимаем шапку над остальным контентом */
        flex-direction: column; /* Складываем шапку в столбик */
        align-items: flex-start;
        gap: 15px;
    }

    .admin-header h1 {
        font-size: 1.5em;
    }

    .admin-actions {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .admin-actions .btn {
        width: 100%; /* Кнопки на всю ширину */
        margin-left: 0; /* Убираем отступ */
        padding: 12px;
        box-sizing: border-box;
    }

    /* Убедимся, что основная сетка админ-панели всегда в одну колонку на мобильных */
    #categories-container.admin-categories-grid {
        grid-template-columns: 1fr; 
        gap: 15px;
    }

    /* --- Клиентская часть --- */
    .greeting { font-size: 1.5em; }

    .product-card {
        width: 30.33%; /* Возвращаем три колонки */
        margin: 0 1.5% 15px 1.5%;
        float: left; /* Возвращаем float */
    }

    .modal-header { height: 30vh; }
    .modal-title { font-size: 1.5em; }
    .modal-footer {
        flex-direction: column; /* Складываем футер в столбик */
        align-items: stretch;
        gap: 15px;
    }

    .quantity-selector {
        justify-content: center;
    }

        .checkout-button {
        padding: 18px;
        font-size: 1.1em;
    }
}



/* Dropdown Menu */
.user-profile {
    position: relative;
    cursor: pointer;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    z-index: 1000;
    width: 180px;
}

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

.dropdown-menu a {
    display: block;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
}

.dropdown-menu a:hover {
    background-color: #f5f5f5;
}

.dropdown-menu .logout-btn {
    color: var(--danger);
}

.dropdown-menu .logout-btn:hover {
    background-color: #ffebee;
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -5px;
    right: 15px;
    width: 10px;
    height: 10px;
    background-color: white;
    transform: rotate(45deg);
    z-index: -1;
}

/* --- Адаптивные стили для очень маленьких экранов --- */
@media (max-width: 480px) {
    .product-card {
        width: 47%; /* Две колонки */
        margin: 0 1.5% 15px 1.5%;
    }
}

/* --- Адаптация админ-панели и модальных окон --- */
@media (max-width: 768px) {
    /* --- Общие изменения --- */
    body {
        -webkit-text-size-adjust: 100%;
    }

    .admin-container, #product-catalog {
        padding: 10px;
    }

    /* --- Админ-панель --- */
    .admin-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .admin-header h1 {
        font-size: 1.5em;
        text-align: center;
        border-bottom: none;
        padding-bottom: 0;
    }

    .admin-actions {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .admin-actions .btn {
        width: 100%;
        margin-left: 0;
        padding: 12px;
        box-sizing: border-box;
    }

    #categories-container.admin-categories-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* --- Адаптация модального окна настроек --- */
    .modal-overlay.wide .modal-content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        padding: 15px;
    }

    .modal-header-tabs {
        gap: 10px;
        margin-bottom: 15px;
    }

    .modal-header-tabs .tab-link {
        font-size: 1.1em;
        padding: 10px 0;
    }

    .categories-settings-layout {
        flex-direction: column;
        gap: 20px;
    }

    .categories-column {
        border-right: none;
        padding-right: 0;
    }

    .filters-container {
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-filter {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    #modifier-form {
        flex-direction: column;
        gap: 10px;
    }

    #modifier-form input {
        width: 100%;
    }

    /* --- Клиентская часть --- */
    .greeting { font-size: 1.5em; }

    .product-card {
        width: 47%; /* Две колонки на мобильных */
        margin: 0 1.5% 15px 1.5%;
    }

    .modal-header { height: 30vh; }
    .modal-title { font-size: 1.5em; }
    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .quantity-selector {
        justify-content: center;
    }

        .checkout-button {
        padding: 18px;
        font-size: 1.1em;
    }
}

