:root {
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --primary-color: #007AFF; /* iOS Blue */
    --primary-bg-fade: rgba(0, 122, 255, 0.1);
    --success-color: #34C759;
    --danger-color: #FF3B30;
    --text-main: #1C1C1E;
    --text-secondary: #8E8E93;
    --bg-overlay: rgba(245, 245, 247, 0.4);
    --radius-l: 24px;
    --radius-m: 14px;
}

html { 
    height: 100%; 
    background: url('background.jpg') no-repeat center center fixed; 
    background-size: cover; 
    background-image: linear-gradient(135deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.2) 100%), url('background.jpg');
}

body { 
    width: 100%; height: 100%; margin: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, Helvetica, Arial, sans-serif; 
    display: flex; justify-content: center; align-items: center; 
    overflow: hidden; 
}

/* Фон */
#cloud-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.cloud { position: absolute; background: url('cloud.png') no-repeat center/contain; opacity: 0.1; transition: all 15s linear; }

/* Навигация */
.nav-glass-btn {
    position: fixed; top: 20px; z-index: 100;
    width: 44px; height: 44px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-main); border: 1px solid rgba(255,255,255,0.5);
    cursor: pointer; padding: 0; text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.nav-glass-btn:hover { transform: scale(1.1); background: #fff; }
.nav-glass-btn svg { width: 22px; height: 22px; }
.back-btn { left: 20px; }
.right-nav-group { position: fixed; top: 20px; right: 20px; display: flex; gap: 12px; z-index: 100; }
.right-nav-group .nav-glass-btn { position: relative; top: 0; right: 0; }

/* Основной блок */
.content-block { 
    position: relative; 
    width: 95%; max-width: 900px; height: 90vh; 
    background: var(--bg-overlay);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border-radius: 32px; border: 1px solid rgba(255, 255, 255, 0.3); 
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2); 
    display: flex; flex-direction: column; 
    overflow: hidden; z-index: 10;
}

/* Хедер контента */
.glass-header {
    padding: 24px 30px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    flex-shrink: 0; text-align: center;
}
.glass-header h1 { margin: 0; font-size: 28px; font-weight: 800; color: #000; }
.glass-header .subtitle { display: none; } /* Скрываем подзаголовок по запросу */

/* Скролл текста оферты */
.oferta-scroll-wrapper {
    flex: 1; overflow-y: auto; padding: 10px 30px;
    scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.2) transparent;
}
.oferta-scroll-wrapper::-webkit-scrollbar { width: 6px; }
.oferta-scroll-wrapper::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 10px; }

.oferta-section { margin-bottom: 25px; }
.oferta-section h3 { font-size: 18px; margin-bottom: 10px; color: var(--text-main); }
.section-text { font-size: 15px; line-height: 1.6; color: #333; text-align: justify; }
.empty-message { text-align: center; color: var(--text-secondary); padding: 40px; }

/* Футер с кнопкой */
.bottom-bar {
    padding: 20px 30px;
    background: rgba(255,255,255,0.3);
    border-top: 1px solid rgba(255,255,255,0.3);
    flex-shrink: 0;
}

/* Кнопки и инпуты (iOS Style) */
.ios-primary-btn, .ios-secondary-btn {
    border: none; border-radius: 14px;
    font-size: 17px; font-weight: 600; cursor: pointer;
    transition: transform 0.1s; padding: 14px;
}
.ios-primary-btn { background: var(--primary-color); color: white; box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3); }
.ios-primary-btn:active { transform: scale(0.98); }
.ios-secondary-btn { background: rgba(255,255,255,0.8); color: var(--text-main); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.full-width-btn { width: 100%; }

.glass-input, .glass-textarea {
    width: 100%; padding: 14px 16px;
    border: 1px solid rgba(0,0,0,0.1); border-radius: 12px;
    background: rgba(255,255,255,0.5);
    font-size: 16px; box-sizing: border-box; margin-bottom: 0;
    transition: background 0.2s;
}
.glass-input:focus { background: #fff; outline: none; border-color: var(--primary-color); }

/* Модальные окна */
.ios-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(5px);
    z-index: 1000; opacity: 0; visibility: hidden;
    transition: opacity 0.3s;
    display: flex; justify-content: center; align-items: center;
}
.ios-modal-overlay.active { opacity: 1; visibility: visible; }

.ios-modal-card {
    width: 90%; max-width: 400px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    border-radius: 28px; padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; flex-direction: column; max-height: 85vh;
}
.ios-modal-overlay.active .ios-modal-card { transform: scale(1) translateY(0); }

/* Модификации модалок */
.large-card { max-width: 600px; height: auto; }
.mini-card { max-width: 320px; text-align: center; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-shrink: 0; }
.modal-header h3 { margin: 0; font-size: 20px; font-weight: 700; }
.close-icon { 
    background: rgba(0,0,0,0.05); border: none; width: 30px; height: 30px; border-radius: 50%; 
    font-size: 20px; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* Сетка формы */
.scrollable-form { overflow-y: auto; padding-right: 5px; }
.form-section-title { font-size: 13px; text-transform: uppercase; color: var(--text-secondary); margin: 15px 0 8px; font-weight: 600; }
.input-grid { display: grid; gap: 10px; margin-bottom: 10px; }
.input-stack { display: flex; flex-direction: column; gap: 10px; }

/* Адаптив сетки */
@media (min-width: 600px) {
    .large-card .input-grid { grid-template-columns: 1fr 1fr; }
    .large-card .input-grid input:first-child:nth-last-child(3) { grid-column: span 1; }
}

/* Дети */
.children-header { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.small-glass-btn { 
    background: var(--primary-bg-fade); color: var(--primary-color); border: none; 
    border-radius: 12px; padding: 6px 12px; font-weight: 600; cursor: pointer; 
}
.child-card {
    background: rgba(255,255,255,0.4); border-radius: 16px; padding: 15px;
    margin-bottom: 10px; border: 1px solid rgba(0,0,0,0.05);
    animation: slideIn 0.3s ease;
}
.child-card-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.remove-child-btn { background: none; border: none; color: var(--danger-color); font-size: 20px; cursor: pointer; padding: 0; }

/* Чекбокс */
.checkbox-wrapper { display: flex; gap: 12px; margin: 20px 0; align-items: flex-start; }
.ios-checkbox { width: 20px; height: 20px; margin-top: 3px; }
.checkbox-wrapper label { font-size: 13px; line-height: 1.4; color: var(--text-main); }

.modal-footer { margin-top: 10px; padding-top: 10px; }

/* === РЕЗУЛЬТАТ ПОИСКА И ТУЛБАР === */

/* Контейнер результата - растягиваем на всю высоту */
#check-result-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0; /* Важно для работы скролла во flex */
}

/* Статус "Найдено" */
.result-status { 
    text-align: center; 
    color: var(--success-color); 
    font-weight: 700; 
    margin-bottom: 10px; 
    font-size: 13px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Панель кнопок сверху */
.actions-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
    overflow-x: auto; /* Скролл на узких экранах */
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
}

/* Стили кнопок тулбара */
.toolbar-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(118, 118, 128, 0.12);
    color: var(--primary-color);
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}
.toolbar-btn:hover { background: rgba(118, 118, 128, 0.2); }
.toolbar-btn svg { width: 16px; height: 16px; }

/* Акцентная кнопка (Продлить) */
.toolbar-btn.primary {
    background: var(--primary-bg-fade);
    color: var(--primary-color);
}
.toolbar-btn.primary:hover {
    background: rgba(0, 122, 255, 0.2);
}

/* Область текста скроллируемая */
.scrollable-result {
    flex: 1;
    overflow-y: auto;
    background: rgba(0,0,0,0.03);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid rgba(0,0,0,0.05);
    /* Кастомный скролл */
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.2) transparent;
}
.scrollable-result::-webkit-scrollbar { width: 4px; }
.scrollable-result::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 4px; }

/* Контент внутри результата */
.result-card-content { font-size: 14px; line-height: 1.5; color: var(--text-main); }
.result-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; font-weight: 600; }
.result-children-title { margin-top: 10px; font-weight: 600; font-size: 13px; border-top: 1px solid rgba(0,0,0,0.05); padding-top: 5px; }
.result-children-list { padding-left: 20px; margin: 5px 0 0; }

/* Кнопка Назад */
.back-to-search-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    padding: 10px;
    cursor: pointer;
    border-top: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
}
.back-to-search-btn:hover { color: var(--text-main); }

/* === Окно успеха (Download/Print) === */
.success-icon-wrapper { width: 60px; height: 60px; background: var(--success-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 15px; color: white; }
.success-icon-wrapper svg { width: 30px; height: 30px; }
.center-text { text-align: center; margin: 0; }
.sub-text { color: var(--text-secondary); font-size: 14px; margin-top: 5px; text-align: center; }
.action-buttons-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.icon-btn-text { display: flex; align-items: center; justify-content: center; gap: 8px; }
.icon-btn-text svg { width: 18px; height: 18px; }

/* Анимации */
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Печать */
#print-area { display: none; }
@media print {
    body, html { height: auto; overflow: visible; background: none; }
    body > *:not(#print-area) { display: none !important; }
    #print-area { display: block !important; padding: 2cm; font-family: serif; font-size: 12pt; color: black; }
    .user-consent-block { border: 1px solid #000; padding: 15px; margin-top: 20px; }
}

/* Мобильный адаптив */
@media (max-width: 600px) {
    .content-block { width: 100%; height: 100%; border-radius: 0; }
    .glass-header { padding-top: 60px; }
    .input-grid { grid-template-columns: 1fr; }
    .ios-modal-card.large-card { height: 95vh; padding: 20px; }
}

/* --- СТИЛИ ДЛЯ ИНПУТОВ С ИКОНКАМИ (MODERN) --- */

.input-grid-modern {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px;
}
/* Адаптив для грида */
@media (max-width: 500px) {
    .input-grid-modern { grid-template-columns: 1fr; }
}

.input-stack {
    display: flex; flex-direction: column; gap: 10px;
}

.input-wrapper { position: relative; width: 100%; }

.input-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    font-size: 16px; opacity: 0.7; pointer-events: none; z-index: 2;
}

.glass-input-modern {
    width: 100%; padding: 12px 12px 12px 40px; /* Отступ под иконку */
    border: 1px solid rgba(0,0,0,0.1); border-radius: 12px;
    background: rgba(255,255,255,0.5);
    font-size: 15px; color: #000;
    transition: all 0.2s; box-sizing: border-box;
}
.glass-input-modern:focus {
    background: #fff; border-color: var(--primary-color); outline: none;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.15);
}

/* Tooltips (Всплывающие подсказки) */
.tooltip-container { position: relative; }
.tooltip-container:hover::after {
    content: attr(data-tooltip);
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    background: rgba(28, 28, 30, 0.9); 
    color: #fff; padding: 6px 10px; border-radius: 8px;
    font-size: 12px; white-space: nowrap; pointer-events: none;
    opacity: 0; visibility: hidden; transition: opacity 0.2s, transform 0.2s;
    margin-bottom: 8px; z-index: 100;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.tooltip-container:hover::after { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(-2px); }

/* Треугольник для тултипа */
.tooltip-container:hover::before {
    content: ''; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
    border: 5px solid transparent; border-top-color: rgba(28, 28, 30, 0.9);
    margin-bottom: -2px; opacity: 0; visibility: hidden; transition: opacity 0.2s;
}
.tooltip-container:hover::before { opacity: 1; visibility: visible; }