/*
 * Стили для "Дели счёт" — Разделение чека
 * Версия 4.3 — Язык виден, чаевые горизонтально
 */

* {
    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,
#tip-controls {
    padding: 16px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 12px;
}

.participant input,
.item input,
.item-name,
.item-price,
.item-quantity {
    flex: 1;
    min-width: 120px;
    padding: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 17px;
    font-family: inherit;
}

.remove-participant,
.remove-item {
    background: #ff3b30;
    color: white;
    border: none;
    padding: 10px 14px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    min-width: 44px;
}

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

#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) {
    .tab-button {
        font-size: 12.8px;
        padding: 11.2px 12.8px;
        min-width: 88px;
    }

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

    button,
    .remove-participant,
    .remove-item {
        font-size: 13.6px;
        padding: 11.2px 16px;
    }

    .participant,
    .item,
    #tip-controls {
        padding: 12.8px;
        margin-bottom: 9.6px;
    }

    #tip-controls {
        flex-direction: row !important;
        align-items: center !important;
        gap: 12.8px !important;
        flex-wrap: wrap !important;
    }

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

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

    @media (max-width: 480px) {
        #logo-img {
            width: 200px;
            height: 200px;
        }
    }
}
