/* ========== ОСНОВНОЙ КАРКАС ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    background-color: #fef7e9;
    color: #4a2c1a;
    line-height: 1.6;
}

main {
    flex: 1;
    width: 100%;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* ========== ШАПКА ========== */
header {
    background-color: #b22222;
    color: #ffd700;
    border-bottom: 5px solid #ff8c00;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    width: 100%;
    position: relative;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
}

.logo-text {
    flex-shrink: 0;
}

.logo-text a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-text img {
    height: 90px;
    width: auto;
    display: block;
}

header nav {
    flex-shrink: 0;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 25px;
    margin: 0;
    padding: 0;
    align-items: center;
}

header nav ul li {
    display: flex;
    align-items: center;
}

header nav ul li a {
    color: #ffd700;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 30px;
    transition: all 0.3s;
    white-space: nowrap;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

header nav ul li a:hover {
    background-color: #ffd700;
    color: #b22222;
    border-color: #ff8c00;
    transform: translateY(-2px);
}

header::after {
    content: "";
    display: block;
    height: 3px;
    background: linear-gradient(90deg, #FFD700, #FF8C00, #FFD700);
    width: 100%;
    margin-top: 0;
}

/* ========== КАРТОЧКИ ТОВАРОВ ========== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.product-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(178, 34, 34, 0.2);
    border-color: #b22222;
}

.product-card h3 {
    color: #b22222;
    font-size: 20px;
    margin: 15px 0 10px;
    font-weight: 700;
}

.product-card p {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
    flex-grow: 1;
}

.price {
    font-size: 24px;
    font-weight: 900;
    color: #ff8c00;
    margin: 15px 0;
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
}

.product-image-placeholder {
    width: 100%;
    height: 200px;
    background-color: #f5f5f5;
    border-radius: 10px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    border: 1px solid #e0e0e0;
}

.product-description {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    flex-grow: 1;
}

.product-category {
    display: inline-block;
    background: #e0c9a6;
    color: #4a2c1a;
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 12px;
    margin-bottom: 10px;
}

/* ========== КНОПКИ ========== */
.btn {
    display: inline-block;
    background-color: #b22222;
    color: #ffd700;
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.btn:hover:not(:disabled) {
    background-color: #8b1a1a;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(178, 34, 34, 0.4);
}

.btn:disabled {
    background-color: #8B4513;
    color: #e0c9a6;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-guest {
    background: #8B4513;
}

.btn-guest:hover {
    background: #6b3410;
}

/* ========== УПРАВЛЕНИЕ В КАТАЛОГЕ ========== */
.product-cart-controls {
    margin-top: 15px;
    width: 100%;
}

.cart-quantity-control {
    background: #f8f9fa;
    border: 2px solid #b22222;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.in-cart-label {
    color: #b22222;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 0;
    padding: 0;
}

.quantity-control-btn {
    width: 40px;
    height: 40px;
    background: #b22222;
    color: #ffd700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    padding: 0;
    margin: 0;
    border: none;
    box-sizing: border-box;
    transition: all 0.3s;
}

.quantity-control-btn:hover {
    background: #8b1a1a;
    transform: scale(1.05);
}

.cart-quantity {
    font-size: 22px;
    font-weight: 700;
    color: #b22222;
    min-width: 40px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
}

/* ========== ФОРМЫ ========== */
.form-container {
    max-width: 400px;
    margin: 40px auto;
    background: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    border-top: 5px solid #b22222;
}

.form-container h2 {
    text-align: center;
    color: #b22222;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

/* ========== ТАБЛИЦЫ ========== */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    margin-top: 20px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #b22222;
    color: #ffd700;
}

tr:hover {
    background-color: #f5f5f5;
}

/* ========== УВЕДОМЛЕНИЕ ПО ЦЕНТРУ ========== */
.center-notification {
    position: fixed;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: auto;
    min-width: 300px;
    max-width: 450px;
    padding: 0 20px;
    animation: slideDown 0.5s ease-out, fadeOut 0.5s ease-out 2.5s forwards;
    pointer-events: none;
}

.notification-box {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    border-radius: 50px;
    padding: 16px 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: none;
    width: 100%;
}

.center-notification.error .notification-box {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.notification-icon {
    font-size: 24px;
    line-height: 1;
}

.notification-text {
    font-size: 16px;
    font-weight: 600;
    color: white;
    text-align: center;
}

@keyframes slideDown {
    from {
        top: -100px;
        opacity: 0;
    }
    to {
        top: 120px;
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
        visibility: hidden;
    }
}

/* ========== ПОДВАЛ ========== */
footer {
    background: #4a2c1a;
    color: #e0c9a6;
    text-align: center;
    padding: 25px 0;
    border-top: 3px solid #b22222;
    width: 100%;
}

footer .container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

footer p {
    margin: 5px 0;
    font-size: 15px;
    color: #e0c9a6;
}

footer a {
    color: #ffd700;
    text-decoration: none;
    border-bottom: 1px dotted #ffd700;
    transition: all 0.3s;
}

footer a:hover {
    color: #ff8c00;
    border-bottom: 1px solid #ff8c00;
}

/* ========== ЗАГОЛОВКИ ========== */
.container h1 {
    color: #b22222;
    font-size: 36px;
    margin-bottom: 10px;
    text-align: center;
}

.container > p {
    text-align: center;
    font-size: 18px;
    color: #4a2c1a;
    margin-bottom: 40px;
}

/* ========== СЧЕТЧИК КОРЗИНЫ ========== */
.cart-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    padding-right: 16px;
}

.cart-badge {
    background: #ffd700;
    color: #b22222;
    font-size: 12px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
    border: 2px solid #b22222;
    margin-left: 3px;
    animation: badgePop 0.3s ease-out;
}

@keyframes badgePop {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

/* ========== УПРАВЛЕНИЕ КОЛИЧЕСТВОМ В КОРЗИНЕ ========== */
.quantity-form {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border: 2px solid #b22222;
    background: white;
    color: #b22222;
    font-size: 18px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.quantity-btn:hover {
    background: #b22222;
    color: #ffd700;
}

.quantity-input {
    width: 50px;
    height: 30px;
    text-align: center;
    border: 2px solid #e0c9a6;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
}

.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.quantity-input[type=number] {
    -moz-appearance: textfield;
}

/* ========== БУРГЕР-МЕНЮ ========== */
.burger-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 100;
}

.burger-btn span {
    display: block;
    width: 28px;
    height: 3px;
    background: #ffd700;
    border-radius: 3px;
    transition: all 0.3s;
}

.burger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-btn.active span:nth-child(2) {
    opacity: 0;
}

.burger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ========== МОБИЛЬНАЯ АДАПТАЦИЯ ========== */
@media (max-width: 992px) {
    .header-inner {
        flex-direction: row;
        justify-content: space-between;
        padding: 10px 15px;
    }

    .logo-text {
        flex-shrink: 0;
        margin: 0;
    }

    .logo-text a {
        justify-content: flex-start;
    }

    .logo-text img {
        height: 70px;
        margin: 0;
        display: block;
    }

    .burger-btn {
        display: flex;
        margin-left: auto;
        z-index: 101;
    }

    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #b22222;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease, padding 0.3s ease;
        box-shadow: 0 10px 20px rgba(0,0,0,0.2);
        z-index: 99;
        width: 100%;
    }

    .main-nav.active {
        max-height: 500px;
        padding: 15px 0;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 5px;
        align-items: center;
    }

    .main-nav ul li {
        width: 100%;
        text-align: center;
    }

    .main-nav ul li a {
        display: block;
        padding: 10px 20px;
        font-size: 16px;
        width: 100%;
        border-radius: 0;
        border: none;
    }

    .main-nav ul li a:hover {
        background: #8b1a1a;
        transform: none;
    }
}

@media (max-width: 768px) {
    .logo-text img {
        height: 65px;
        margin: 0;
    }

    .container {
        width: 95%;
        padding: 10px 0;
    }

    .container h1 {
        font-size: 24px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .product-card {
        padding: 12px;
    }

    .product-card h3 {
        font-size: 17px;
    }

    .price {
        font-size: 20px;
    }

    .filter-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .filter-buttons {
        flex-direction: column;
    }

    .filter-buttons .btn-filter,
    .filter-buttons .btn-reset {
        width: 100%;
        text-align: center;
    }

    .catalog-header {
        flex-direction: column;
        text-align: center;
    }

    .sort-wrapper select {
        width: 100%;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 13px;
    }

    th, td {
        padding: 8px 10px;
    }

    .quantity-form {
        flex-wrap: nowrap;
    }

    .quantity-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .quantity-input {
        width: 40px;
        height: 28px;
        font-size: 13px;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .contact-info,
    .contact-form {
        padding: 20px;
    }

    .info-item {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .profile-container {
        padding: 0 10px;
    }

    .profile-section {
        padding: 15px;
    }

    .orders-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .orders-table th,
    .orders-table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .form-container {
        padding: 20px;
        margin: 20px auto;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 14px;
        padding: 8px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .phone-input-wrapper {
        flex-wrap: wrap;
    }

    .phone-prefix {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
        text-align: center;
    }

    .slide img {
        height: 200px;
    }

    .slide-content {
        max-width: 90%;
        padding: 10px 15px;
        bottom: 15px;
        left: 15px;
    }

    .slide-content h2 {
        font-size: 16px;
    }

    .slide-content p {
        font-size: 12px;
    }

    .prev,
    .next {
        padding: 8px 12px;
        font-size: 16px;
    }

    .results-info {
        flex-direction: column;
        text-align: center;
        gap: 5px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 10px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stats-today {
        padding: 15px;
    }

    .stats-today h3 {
        font-size: 16px;
    }

    .stats-today p {
        font-size: 13px;
    }

    .new-orders-badge {
        font-size: 13px;
        padding: 6px 12px;
    }

    .search-grid {
        grid-template-columns: 1fr;
    }

    .search-buttons {
        flex-direction: column;
    }

    .search-buttons button,
    .search-buttons a {
        width: 100%;
        text-align: center;
    }

    .feedback-card {
        padding: 12px;
    }

    .feedback-header {
        flex-direction: column;
        gap: 5px;
    }

    .feedback-actions {
        flex-direction: column;
        gap: 8px;
    }

    .feedback-actions a {
        text-align: center;
    }

    .admin-header .container {
        flex-direction: column;
        text-align: center;
        padding: 10px 15px;
    }

    .admin-header h1 {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .admin-nav {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .admin-nav a {
        font-size: 13px;
        padding: 4px 10px;
    }

    .admin-container {
        padding: 10px;
    }

    .admin-container h1 {
        font-size: 24px;
    }

    .admin-container h2 {
        font-size: 18px;
    }

    .add-form {
        padding: 15px;
    }

    .center-notification {
        min-width: 250px;
        top: 100px;
    }

    .cart-badge {
        min-width: 16px;
        height: 16px;
        font-size: 10px;
    }

    .quantity-control-btn {
        width: 35px;
        height: 35px;
        font-size: 24px;
    }

    @keyframes slideDown {
        to {
            top: 100px;
        }
    }
}

@media (max-width: 576px) {
    .logo-text img {
        height: 55px;
        margin: 0;
    }

    .main-nav ul li a {
        font-size: 14px;
        padding: 8px 15px;
    }

    .container h1 {
        font-size: 20px;
    }

    .product-card h3 {
        font-size: 15px;
    }

    .price {
        font-size: 17px;
    }

    .btn {
        font-size: 13px;
        padding: 8px 15px;
    }

    .admin-nav a {
        font-size: 12px;
        padding: 3px 8px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 8px;
    }

    .stat-value {
        font-size: 17px;
    }

    .stat-label {
        font-size: 10px;
    }

    .center-notification {
        min-width: 200px;
        padding: 0 10px;
    }

    .notification-box {
        padding: 12px 20px;
    }

    .notification-text {
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    .logo-text img {
        height: 45px;
        margin: 0;
    }

    .main-nav ul li a {
        font-size: 13px;
        padding: 6px 12px;
    }

    .burger-btn span {
        width: 24px;
        height: 2px;
    }

    .container h1 {
        font-size: 18px;
    }

    .product-card {
        padding: 10px;
    }

    .product-card h3 {
        font-size: 14px;
    }

    .price {
        font-size: 15px;
    }

    .btn {
        font-size: 12px;
        padding: 8px 12px;
    }

    .admin-nav a {
        font-size: 11px;
        padding: 3px 6px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 5px;
    }

    .stat-card {
        padding: 6px;
    }

    .stat-value {
        font-size: 15px;
    }

    .stat-label {
        font-size: 9px;
    }

    .center-notification {
        min-width: 180px;
    }

    .notification-box {
        padding: 10px 15px;
    }
}

/* ========== ФИКСЫ ДЛЯ ТАБЛИЦ АДМИНКИ ========== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 10px 0 20px;
    border-radius: 10px;
}

.admin-container table {
    min-width: 100%;
    width: 100%;
    table-layout: auto;
}

.admin-container table th,
.admin-container table td {
    padding: 6px 8px;
    font-size: 13px;
    vertical-align: middle;
    word-break: break-word;
}

.admin-container table th {
    white-space: nowrap;
}

.action-links {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
}

.action-links a {
    font-size: 12px;
    padding: 2px 6px;
    margin: 0;
    display: inline-block;
    text-decoration: none;
    border-radius: 3px;
}

.action-links span {
    font-size: 12px;
    color: #999;
}

@media (max-width: 992px) {
    .admin-container table th,
    .admin-container table td {
        padding: 4px 6px;
        font-size: 11px;
        min-width: 50px;
    }

    .admin-container table td:last-child {
        min-width: 80px;
    }

    .action-links {
        gap: 2px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .action-links a {
        font-size: 10px;
        padding: 2px 4px;
        white-space: nowrap;
    }

    .user-address {
        max-width: 80px;
        font-size: 10px;
        word-break: break-word;
        white-space: normal;
    }

    .user-phone {
        font-size: 10px;
        white-space: nowrap;
    }

    .badge {
        font-size: 9px;
        padding: 2px 6px;
        white-space: nowrap;
    }

    .order-address {
        max-width: 80px;
        font-size: 10px;
        word-break: break-word;
        white-space: normal;
    }

    .status-select {
        width: 90px;
        font-size: 10px;
        padding: 3px 4px;
    }

    .status-badge {
        font-size: 10px;
        padding: 3px 6px;
        white-space: nowrap;
    }
}

@media (max-width: 576px) {
    .admin-container table th,
    .admin-container table td {
        padding: 3px 4px;
        font-size: 10px;
        min-width: 40px;
    }

    .admin-container table td:last-child {
        min-width: 70px;
    }

    .action-links a {
        font-size: 9px;
        padding: 1px 4px;
    }

    .user-address {
        max-width: 60px;
        font-size: 9px;
    }

    .user-phone {
        font-size: 9px;
    }

    .badge {
        font-size: 8px;
        padding: 1px 4px;
    }

    .order-address {
        max-width: 60px;
        font-size: 9px;
    }

    .status-select {
        width: 70px;
        font-size: 9px;
        padding: 2px 3px;
    }

    .status-badge {
        font-size: 9px;
        padding: 2px 4px;
    }
}