/*
 * Стили для "Дели счёт" — Разделение чека
 * Версия 4.4.1 — Кнопки удаления уменьшены и фиксированы для мобильных
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: #f9f9fb;
    color: #333;
    line-height: 1.6;
    padding: 0;
    margin: 0;
    min-height: 100vh;
}

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

/* === Логотип — 250×250 px === */
.app-header {
    text-align: center;
    padding: 30px 0 20px;
}

.logo-container {
    display: inline-block;
}

#logo-img {
    width: 250px;
    height: 250px;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
    transition: transform 0.3s ease;
    object-fit: cover;
}

#logo-img:hover {
    transform: scale(1.03);
}

/* === Переключатель языка с текстом === */
.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

#lang-toggle {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #666;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

#lang-toggle:hover {
    color: #0071e3;
    transform: scale(1.05);
}

#lang-text {
    font-size: 15px;
    font-weight: 500;
}

#lang-menu {
    position: absolute;
    top: 40px;
    right: 0;
    background: white;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
}

#lang-menu button {
    width: 100%;
    text-align: left;
    padding: 10px 15px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

#lang-menu button:hover {
    background: #f5f5f5;
}

/* === Вкладки === */
.tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    margin: 20px 0;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    background: #f0f0f0;
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
    min-height: 48px;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab-button {
    flex: 1 1 140px;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    background: transparent;
    border: none;
    border-radius: 9px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 110px;
}

.tab-button.active {
    background: white;
    color: #0071e3;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    font-weight: 600;
}

/* === Формы — универсальные стили === */
.participant,
.item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 10px;
}

/* Поля ввода */
.participant input,
.item input,
.item-name,
.item-price,
.item-quantity {
    flex: 1;
    min-width: 100px;
    padding: 10px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
}

/* === Кнопки удаления — маленькие, как галочки === */
.remove-participant,
.remove-item {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    background: #ff3b30;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: 6px;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}

.remove-participant:hover,
.remove-item:hover {
    background: #d63031;
    transform: scale(1.1);
}

/* === Чаевые — всегда горизонтально === */
#tip-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

#tip-percent,
#tip-fixed {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

#tip-amount,
#tip-fixed-amount {
    width: 90px;
    padding: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 17px;
}

.or-text {
    color: #777;
    font-weight: 500;
    white-space: nowrap;
}

/* === Кнопки действия === */
button {
    background: #0071e3;
    color: white;
    border: none;
    padding: 14px 20px;
    font-size: 17px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

button:hover {
    background: #005edc;
}

button:active {
    transform: scale(0.98);
}

#add-participant-btn {
    background: #34c759;
    font-size: 17px;
    padding: 16px;
    width: 100%;
    margin: 16px 0;
}

#calculate-btn {
    background: #ff9500;
    font-size: 18px;
    padding: 18px;
    width: 100%;
    font-weight: 600;
    margin: 24px 0;
}

/* === Результат === */
#result {
    display: none;
    margin-top: 24px;
    padding: 28px;
    background: #f0f8ff;
    border: 1px solid #d0e0ff;
    border-radius: 14px;
}

#result-details {
    line-height: 1.9;
    font-size: 17px;
}

/* === Сканирование === */
#scan-qr {
    background: #5856d6;
    margin: 24px 0;
    padding: 18px;
    width: 100%;
}

#upload-area {
    text-align: center;
    padding: 40px 20px;
    border: 2px dashed #0071e3;
    border-radius: 14px;
    cursor: pointer;
    background: #f8f8ff;
    transition: all 0.2s;
}

#upload-area:hover {
    background: #eef4ff;
    border-color: #005edc;
}

#upload-area p {
    color: #555;
    font-size: 17px;
    margin: 8px 0;
}

#receipt-preview img {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* === Уведомления === */
.notification {
    position: fixed;
    top: 30px;
    right: 30px;
    padding: 16px 22px;
    border-radius: 12px;
    color: white;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    font-size: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

/* === Скрытие табов === */
.tab-content {
    display: none;
}

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

/* === Адаптивность для мобильных === */
@media (max-width: 768px) {
    .app-header {
        padding: 20px 0 16px;
    }

    .tab-button {
        font-size: 12.8px;
        padding: 11.2px 10px;
        min-width: 88px;
    }

    input[type="text"],
    input[type="number"],
    .item-name,
    .item-price,
    .item-quantity,
    #tip-amount,
    #tip-fixed-amount {
        font-size: 14px;
        padding: 9px;
        border-radius: 6px;
    }

    /* === ГАРАНТИРОВАННЫЙ ФИКС КНОПОК УДАЛЕНИЯ НА МОБИЛЬНЫХ === */
    .remove-participant,
    .remove-item {
        all: unset !important;
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
        min-height: 26px !important;
        background: #ff3b30 !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        font-size: 16px !important;
        font-weight: bold !important;
        line-height: 1 !important;
        text-align: center !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-left: 6px !important;
        padding: 0 !important;
        transition: background 0.2s, transform 0.1s !important;
    }

    .remove-participant:hover,
    .remove-item:hover {
        background: #d63031 !important;
        transform: scale(1.1) !important;
    }

    /* Формы */
    .participant,
    .item {
        padding: 10px;
        gap: 8px;
        flex-wrap: wrap;
    }

    #add-participant-btn,
    #calculate-btn {
        font-size: 16px;
        padding: 14px;
    }

    /* === Дополнительный фикс на очень малых экранах === */
    @media (max-width: 480px) {
        #logo-img {
            width: 200px;
            height: 200px;
        }

        .language-switcher {
            top: 12px;
            right: 12px;
        }

        #lang-toggle {
            font-size: 14px;
            padding: 6px 10px;
        }

        #lang-text {
            font-size: 13px;
        }

        .remove-participant,
        .remove-item {
            width: 24px !important;
            height: 24px !important;
            font-size: 15px !important;
        }
    }
}
