/* ============================================
   GLOBAL BOTTOM SHEETS (Unified)
   ============================================ */

/* Overlay (затемнение) */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2999; /* Golden z-index: overlay под шторкой */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.bottom-sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Bottom Sheet */
.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #242424;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Settings sheet - темнее + защита от клавиатуры */
.bottom-sheet.settings-sheet {
    background: #0B0B12;
    max-height: 65vh;  /* ✅ Не до верха (было 90vh) */
    position: fixed;
}

/* Крестик в правом верхнем углу */
.settings-close-btn {
    position: absolute;
    right: 16px;
    top: 16px;  /* ✅ Угол (не center) */
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.settings-close-btn:active {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(0.94);
}

.bottom-sheet.active {
    transform: translateY(0);
}

/* Handle (полоска для свайпа) */
.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 12px auto 8px;
    flex-shrink: 0;
}

/* Header */
.bottom-sheet-header {
    padding: 0 20px 16px;
    text-align: center;
    flex-shrink: 0;
}

.bottom-sheet-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.bottom-sheet-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

/* Меняющееся слово в подзаголовке */
.changing-word {
    display: inline-block;
    color: rgba(148, 87, 235, 1);
    font-weight: 600;
    transition: opacity 0.3s ease;
}

/* Быстро меняющееся слово в первом пункте - с blur эффектом */
.rotating-word {
    display: inline-block;
    color: rgba(148, 87, 235, 1);
    font-weight: 600;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

/* Content (скроллируемая область) */
.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 20px 20px;
    -webkit-overflow-scrolling: touch;
}

/* ❌ LEGACY REMOVED: publish-notice, publish-input - moved to JS inline styles */

/* Actions (кнопки внизу) */
.bottom-sheet-actions {
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex;
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.bottom-sheet-btn {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bottom-sheet-btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

.bottom-sheet-btn-cancel:active {
    background: rgba(255, 255, 255, 0.12);
}

.bottom-sheet-btn-continue {
    background: #007AFF;
    color: #ffffff;
}

.bottom-sheet-btn-continue:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.bottom-sheet-btn-continue:not(:disabled):active {
    background: #0056b3;
}

/* Upload Tips */
.upload-tips {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.upload-tip {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.tip-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 122, 255, 0.2);
    color: #007AFF;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tip-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

/* Upload Area */
.upload-area {
    margin-bottom: 16px;
}

.upload-button {
    width: 100%;
    padding: 16px;
    background: rgba(0, 122, 255, 0.15);
    border: 2px dashed rgba(0, 122, 255, 0.4);
    border-radius: 16px;
    color: #007AFF;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-button:active {
    background: rgba(0, 122, 255, 0.25);
    border-color: rgba(0, 122, 255, 0.6);
}

/* Photos Grid */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
    max-height: 300px; /* Ограничение высоты чтобы не растягивался */
    overflow-y: auto;
}

.photo-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #0B0B12;
}

.photo-preview img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 1;
}

.photo-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #F5F7FA;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10; /* Поверх img (z-index: 1) */
}

.photo-remove:active {
    background: rgba(255, 0, 0, 0.8);
    transform: scale(0.9);
}

/* Универсальное поле ввода (используется в upload и settings) */
.upload-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.upload-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.upload-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

/* ============================================
   SETTINGS FIELDS (удобные отступы)
   ============================================ */

.settings-field {
    margin-bottom: 24px;
}

.settings-field-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
}

.settings-input-field {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.settings-input-field:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.settings-input-field::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.settings-textarea {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
    box-sizing: border-box;
    transition: all 0.2s ease;
    resize: none;  /* ✅ Запретить resize */
    max-height: 120px;  /* ✅ Макс 4 строки (~30px * 4) */
    overflow-y: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.settings-textarea:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.settings-textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.settings-field-hint {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    line-height: 1.4;
}

/* Wrapper для input с крестиком */
.settings-input-wrapper {
    position: relative;
}

/* Крестик очистки input */
.settings-input-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.settings-input-clear:active {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-50%) scale(0.9);
}

/* Крестик очистки textarea */
.settings-textarea-clear {
    position: absolute;
    right: 12px;
    top: 12px;  /* Фиксировано сверху */
    width: 22px;
    height: 22px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 5;
}

.settings-textarea-clear:active {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(0.9);
}
