/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 15px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

header h1 {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.8em;
    line-height: 1.3;
}

header p {
    color: #7f8c8d;
    font-size: 1em;
    line-height: 1.4;
}

.form-container {
    background: white;
    padding: 25px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 1em;
}

select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c3e50' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 20px;
    padding-right: 50px;
}

select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

select:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.7;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    touch-action: manipulation;
}

button:hover:not(:disabled) {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(52, 152, 219, 0.3);
}

button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loading {
    text-align: center;
    padding: 30px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-container {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 5px solid #3498db;
}

.result-container h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.5em;
    text-align: center;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.result-item {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.result-item h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    font-size: 1.3em;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Базовые стили для строк информации */
.result-item p {
    margin: 12px 0;
    color: #555;
    font-size: 1em;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
}

.result-item .price {
    font-weight: bold;
    color: #27ae60;
    font-size: 1.2em;
    display: inline-block;
    word-break: break-word;
}

/* Стили для предупреждения */
.warning-box {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-left: 5px solid #f39c12;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-size: 1em;
}

.warning-title {
    color: #d35400;
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.warning-text {
    color: #7d6608;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.error-container {
    background: #fee;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
    font-size: 1em;
}

.error-container p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

footer {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 0.9em;
    margin-top: 30px;
    line-height: 1.4;
}

/* ===== Стили для подсказок (tooltip) ===== */
/* Контейнер для иконки и подсказки */
.tooltip-container {
    display: inline-block;
    position: relative;
    margin-left: 2px;
    vertical-align: middle;
}

/* Иконка подсказки (кнопка) */
.tooltip-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background-color: #0066cc;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    margin-left: 2px;
    font-size: 14px;
    user-select: none;
    flex-shrink: 0;
    vertical-align: middle;
    border: none;
    padding: 0;
    background: #0066cc; /* для кнопки */
}

/* Текст подсказки (изначально скрыт) */
.tooltip-example {
    position: absolute;
    left: 100%;        /* справа от контейнера */
    top: 50%;
    transform: translateY(-50%);
    margin-left: 8px;   /* отступ от иконки */
    padding: 4px 10px;
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
    border-radius: 4px;
    font-size: 0.85em;
    color: #0050b3;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

.tooltip-example.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Планшеты и десктопы (ширина больше 768px) */
@media (min-width: 769px) {
    .result-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
}

/* Большие экраны */
@media (min-width: 1024px) {
    header h1 {
        font-size: 2em;
    }
    
    header p {
        font-size: 1.1em;
    }
    
    .form-container {
        padding: 30px;
    }
    
    .result-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}

/* ===== Мобильные стили (до 768px) ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header {
        padding: 15px 10px;
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    header p {
        font-size: 0.95em;
    }
    
    .form-container {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    select {
        padding: 16px;
        font-size: 17px;
        background-position: right 16px center;
        padding-right: 50px;
    }
    
    button {
        padding: 18px;
        font-size: 17px;
        margin-top: 15px;
    }
    
    .result-container {
        padding: 15px;
        margin-top: 20px;
    }
    
    .result-container h2 {
        font-size: 1.3em;
    }
    
    .result-item {
        padding: 15px;
    }
    
    .result-item h3 {
        font-size: 1.2em;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
    
    /* Увеличиваем иконку и межстрочный интервал */
    .tooltip-icon {
        width: 30px;
        height: 30px;
        line-height: 30px;
        font-size: 18px;
        margin-left: 12px;
    }
    
    .result-item p {
        margin: 8px 0;        /* увеличиваем отступы для воздуха */
        line-height: 1.6;      /* увеличиваем межстрочный интервал */
    }
    
    .result-item .price {
        font-size: 1.1em;
    }
    
    /* Подсказки на мобильных: под строкой */
    .tooltip-example {
        left: 0;
        top: 100%;
        transform: none;
        margin-left: 0;
        margin-top: 5px;
        white-space: normal;
        max-width: 250px;
        width: auto;
        z-index: 200;
    }
    
    .warning-box {
        padding: 12px;
        font-size: 0.95em;
        margin: 10px 0;
    }
    
    .warning-title {
        font-size: 1em;
        margin-bottom: 5px;
    }
    
    .warning-text {
        font-size: 0.9em;
    }
    
    .error-container {
        padding: 15px;
        font-size: 0.95em;
    }
    
    footer {
        padding: 15px;
        font-size: 0.85em;
    }
}

/* Маленькие мобильные устройства (до 480px) */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    header {
        padding: 12px 8px;
        margin-bottom: 15px;
    }
    
    header h1 {
        font-size: 1.3em;
    }
    
    header p {
        font-size: 0.8em;
    }
    
    .form-container {
        padding: 15px 12px;
    }
    
    select {
        padding: 14px;
        font-size: 16px;
        background-position: right 12px center;
        padding-right: 45px;
    }
    
    button {
        padding: 16px;
        font-size: 16px;
    }
    
    .result-item p {
        margin: 5px 0;
        font-size: 0.9em;
    }
    
    .result-item .price {
        font-size: 1em;
    }
    
    .tooltip-example {
        max-width: 200px;
        font-size: 0.8em;
    }
    
    footer {
        padding: 15px;
        font-size: 0.8em;
    }
}

/* Bottom Sheet для мобильных подсказок */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 2000;
    visibility: hidden;
}

.bottom-sheet.show {
    transform: translateY(0);
    visibility: visible;
}

.bottom-sheet .sheet-content {
    padding: 20px;
    text-align: left;
}

.bottom-sheet .sheet-title {
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #2c3e50;
}

.bottom-sheet .sheet-text {
    font-size: 1em;
    line-height: 1.5;
    color: #333;
    margin-bottom: 20px;
}

.bottom-sheet .close-sheet {
    display: block;
    width: 100%;
    padding: 14px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.bottom-sheet .close-sheet:hover {
    background: #2980b9;
}

.sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.sheet-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.result-item h4 {
    margin: 20px 0 10px;
    color: #2c3e50;
    font-size: 1.2em;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}