/**
 * Компоненты и модули для сайта пиццерии "Лисицца"
 */

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.modal--open {
    opacity: 1;
    visibility: visible;
}

.modal__content {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-large);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal--open .modal__content {
    transform: scale(1);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.modal__close:hover {
    background-color: var(--bg-light);
    color: var(--text-color);
}

.modal__body {
    padding: 1.5rem;
}

/* ===== УВЕДОМЛЕНИЯ ===== */
.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
}

.notification {
    background-color: white;
    border-radius: var(--border-radius-small);
    box-shadow: var(--shadow-large);
    margin-bottom: 1rem;
    overflow: hidden;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--primary-color);
    opacity: 0;
    max-height: 0;
}

.notification--show {
    transform: translateX(0);
    opacity: 1;
    max-height: 200px;
}

.notification--success {
    border-left-color: var(--success-color);
}

.notification--error {
    border-left-color: var(--error-color);
}

.notification--warning {
    border-left-color: var(--warning-color);
}

.notification--info {
    border-left-color: var(--primary-color);
}

.notification__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.notification__message {
    font-size: 0.875rem;
    color: var(--text-color);
    line-height: 1.4;
}

.notification__close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    transition: var(--transition-fast);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.notification__close:hover {
    color: var(--text-color);
    background-color: var(--bg-light);
}

/* ===== КОРЗИНА ===== */
.cart-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.cart-empty p {
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.cart-items {
    max-height: 400px;
    overflow-y: auto;
}

.cart-item {
    display: grid;
    grid-template-columns: 60px 1fr auto auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

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

.cart-item__image {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius-small);
    overflow: hidden;
}

.cart-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item__details {
    min-width: 0;
}

.cart-item__title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item__size,
.cart-item__extras {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.cart-item__quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: var(--border-radius-small);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-fast);
}

.quantity-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.quantity-value {
    min-width: 20px;
    text-align: center;
    font-weight: 600;
}

.cart-item__price {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.875rem;
}

.cart-item__remove {
    width: 24px;
    height: 24px;
    border: none;
    background-color: var(--error-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.cart-item__remove:hover {
    background-color: #d63031;
    transform: scale(1.1);
}

.cart-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.cart-total {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
}

.cart-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ===== ФОРМЫ ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-label--required::after {
    content: '*';
    color: var(--error-color);
    margin-left: 0.25rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-size: 1rem;
    font-family: var(--font-primary);
    transition: var(--transition-fast);
    background-color: white;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-input--error,
.form-textarea--error,
.form-select--error {
    border-color: var(--error-color);
}

.form-error {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-help {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

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

/* Чекбоксы и радиокнопки */
.form-checkbox,
.form-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.form-checkbox input,
.form-radio input {
    width: auto;
    margin: 0;
}

/* ===== ХЛЕБНЫЕ КРОШКИ ===== */
.breadcrumbs {
    padding: 1rem 0;
    background-color: var(--bg-light);
}

.breadcrumbs__list {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.875rem;
}

.breadcrumbs__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumbs__item:not(:last-child)::after {
    content: '/';
    color: var(--text-muted);
}

.breadcrumbs__link {
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumbs__link:hover {
    color: var(--primary-color);
}

.breadcrumbs__current {
    color: var(--text-color);
    font-weight: 500;
}

/* ===== ПАГИНАЦИЯ ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 3rem 0;
}

.pagination__item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: var(--transition-fast);
}

.pagination__item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination__item--active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination__item--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== ЗАГРУЗЧИК ===== */
.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-light);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

.loader--large {
    width: 40px;
    height: 40px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== ТАБЛИЦЫ ===== */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

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

.table th {
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--text-color);
}

.table tbody tr:hover {
    background-color: var(--bg-light);
}

.table--striped tbody tr:nth-child(even) {
    background-color: var(--bg-light);
}

/* ===== СТАТУСЫ ===== */
.status {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status--new {
    background-color: rgba(116, 185, 255, 0.1);
    color: #74b9ff;
}

.status--confirmed {
    background-color: rgba(255, 165, 2, 0.1);
    color: #ffa502;
}

.status--preparing {
    background-color: rgba(253, 203, 110, 0.1);
    color: #fdcb6e;
}

.status--delivery {
    background-color: rgba(116, 185, 255, 0.1);
    color: #74b9ff;
}

.status--completed {
    background-color: rgba(46, 213, 115, 0.1);
    color: #2ed573;
}

.status--cancelled {
    background-color: rgba(255, 56, 56, 0.1);
    color: #ff3838;
}

/* ===== АДАПТИВНОСТЬ ДЛЯ КОМПОНЕНТОВ ===== */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }

    .modal__content {
        max-height: 95vh;
    }

    .notifications {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .cart-item {
        grid-template-columns: 50px 1fr auto;
        gap: 0.75rem;
    }

    .cart-item__quantity {
        grid-column: 2;
        justify-self: start;
        margin-top: 0.5rem;
    }

    .cart-item__price {
        grid-column: 3;
        grid-row: 1;
    }

    .cart-item__remove {
        grid-column: 3;
        grid-row: 2;
        justify-self: end;
    }

    .cart-actions {
        flex-direction: column;
    }

    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 8px 12px;
    }
}

/* ===== АНИМАЦИИ ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* ===== УТИЛИТЫ ===== */
.text-center {
    text-align: center;
}

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

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

.font-weight-normal {
    font-weight: 400;
}

.font-weight-medium {
    font-weight: 500;
}

.font-weight-semibold {
    font-weight: 600;
}

.font-weight-bold {
    font-weight: 700;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--primary-color);
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-error {
    color: var(--error-color);
}

.bg-light {
    background-color: var(--bg-light);
}

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

.border {
    border: 1px solid var(--border-color);
}

.border-top {
    border-top: 1px solid var(--border-color);
}

.border-bottom {
    border-bottom: 1px solid var(--border-color);
}

.rounded {
    border-radius: var(--border-radius-small);
}

.rounded-lg {
    border-radius: var(--border-radius);
}

.shadow {
    box-shadow: var(--shadow-small);
}

.shadow-md {
    box-shadow: var(--shadow-medium);
}

.shadow-lg {
    box-shadow: var(--shadow-large);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.p-0 {
    padding: 0;
}

.p-1 {
    padding: 0.5rem;
}

.p-2 {
    padding: 1rem;
}

.p-3 {
    padding: 1.5rem;
}

.p-4 {
    padding: 2rem;
}

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-inline {
    display: inline;
}

.d-inline-block {
    display: inline-block;
}

.d-flex {
    display: flex;
}

.d-grid {
    display: grid;
}

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}