/**
 * Screen Backstage CSS
 * Стили экрана Гримёрка (матчинг, форматы)
 */

/* ===== Format Cards Grid ===== */
/* Landing/Desktop: 3 cards in one row, equal size */
.formats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 800px;
    width: 100%;
}

/* TG WebApp/Mobile: компактные карточки в колонку */
.tg-webapp .formats-container {
    grid-template-columns: 1fr;
    max-width: 320px;
    gap: 10px;
    margin: 0 auto;
}

/* Компактные карточки для приложения */
.tg-webapp .format-card,
.tg-webapp .afisha-card {
    padding: 14px 16px;
    min-height: auto;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.tg-webapp .format-icon {
    font-size: 2rem;
    margin-bottom: 0;
    flex-shrink: 0;
}

.tg-webapp .format-card .format-title,
.tg-webapp .afisha-card .format-title {
    font-size: 1.05rem;
    margin-bottom: 2px;
}

.tg-webapp .format-desc,
.tg-webapp .afisha-count {
    font-size: 0.8rem;
}

/* Чекбоксы выровнены по карточкам */
.tg-webapp .tg-consent {
    max-width: 320px;
    margin: 0 auto;
}

/* ===== Афиша — унифицированный стиль с format-card ===== */
.afisha-card {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
    border: 1px solid var(--accent-gold);
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.afisha-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-gold);
    background: rgba(0, 0, 0, 0.6);
}

.afisha-count {
    font-size: 0.85rem;
    color: #ffffff;
    line-height: 1.4;
    animation: afisha-count-glow 2s ease-in-out infinite;
}

@keyframes afisha-count-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Цветная маска с покачиванием */
.afisha-card .format-icon {
    display: inline-block;
    animation: afisha-sway 2s ease-in-out infinite;
}

@keyframes afisha-sway {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.format-card {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
    border: 1px solid var(--accent-gold);
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.format-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-gold);
    background: rgba(0, 0, 0, 0.6);
}

.format-card--primary {
    border-color: var(--accent-gold);
    background: rgba(0, 0, 0, 0.5);
}

.format-card--primary:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: var(--accent-gold);
}

.format-card--scheduled {
    border-color: var(--accent-gold);
    background: rgba(0, 0, 0, 0.5);
}

.format-card--scheduled:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: var(--accent-gold);
}

.format-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: var(--accent-gold);
}

.format-title {
    font-family: 'Oranienbaum', serif;
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--accent-gold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 8px;
}

.format-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

/* ===== Matching Panel ===== */
.matching-panel {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    max-width: 400px;
    width: 100%;
    max-height: calc(100vh - 60px);
    max-height: calc(100dvh - 60px);
    overflow-y: auto;
}

.matching-stage {
    text-align: center;
}

.matching-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

#found-stage .matching-title {
    margin-bottom: 8px;
}

.found-cta {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin: 16px 0 12px;
    text-align: center;
}

.found-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.back-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 16px;
    padding: 8px 0;
    transition: var(--transition-fast);
}

.back-btn:hover {
    color: var(--text-light);
}

/* ===== Criteria Section ===== */
.criteria-section {
    margin-bottom: 24px;
    text-align: left;
}

.checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.matching-panel .btn--full {
    max-width: 280px;
    margin: -8px auto 0;
}

#criteria-back-btn {
    margin-top: 16px;
}

#want-gender .checkbox-option {
    justify-content: center;
}

#want-ages .checkbox-option:last-child {
    grid-column: 1 / -1;
    justify-content: center;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.checkbox-option:hover {
    background: rgba(255, 255, 255, 0.15);
}

.checkbox-option input {
    display: none;
}

.checkbox-option:has(input:checked) {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: #000;
}

.checkbox-option span {
    font-size: 0.9rem;
}

.form-error {
    color: #ff6b6b;
    font-size: 0.9rem;
    margin-bottom: 16px;
    display: none;
}

/* ===== TG Consent ===== */
.tg-consent {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tg-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #ffffff;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    line-height: 1.4;
}

.tg-consent-label:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(232, 184, 85, 0.3);
}

.tg-consent-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin-top: 2px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.tg-consent-label input[type="checkbox"]:checked {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
}

.tg-consent-label input[type="checkbox"]:checked::after {
    content: '✓';
    display: block;
    text-align: center;
    color: #000;
    font-size: 14px;
    line-height: 16px;
    font-weight: bold;
}

.consent-emoji {
    font-size: 1rem;
    margin-right: 4px;
}

.consent-highlight {
    color: var(--accent-gold);
    font-weight: 500;
}

/* ===== Matching Animation ===== */
.matching-animation {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 1.2s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.matching-timer {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-gold);
    margin: 20px 0;
}

.waiting-phrase {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--accent-gold);
    margin: 0 0 16px 0;
    min-height: 1.4em;
    transition: opacity 0.3s ease;
}

.matching-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 24px;
}

.matching-progress-bar {
    height: 100%;
    background: var(--accent-gold);
    width: 0%;
    transition: width 1s linear;
}

/* ===== Found Stage (компактный) ===== */
#found-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding: 4px 0;
}

/* Заголовок + иконка в одну строку */
#found-stage .found-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

#found-stage .found-icon {
    font-size: 2rem;
    line-height: 1;
    margin: 0;
}

#found-stage .matching-title {
    margin: 0;
    font-size: 1.2rem;
}

/* Компактная карточка партнёра (горизонтальная) */
#found-stage .partner-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--accent-gold);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    box-sizing: border-box;
}

#found-stage .partner-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-gold);
    box-shadow: 0 2px 12px rgba(212, 175, 55, 0.3);
    flex-shrink: 0;
}

#found-stage .partner-info {
    text-align: left;
}

#found-stage .partner-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 2px;
}

#found-stage .partner-age {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

/* Кнопка отдельно от карточки */
#found-stage .found-buttons {
    width: 100%;
    margin-top: 8px;
}

#found-stage .found-buttons .btn {
    border-radius: 10px;
}

.found-icon {
    font-size: 2rem;
    margin-bottom: 4px;
    color: var(--accent-gold);
}

.partner-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 12px;
    margin: 10px 0;
}

/* ===== Schedule Date Picker ===== */
.schedule-dates {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.schedule-date-btn {
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: center;
}

.schedule-date-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.schedule-date-btn.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: #000;
}

.schedule-date-btn .date-day {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.schedule-date-btn .date-label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.8;
}

.schedule-date-btn .date-count {
    display: none;
    font-size: 0.65rem;
    color: #4caf50;
    margin-top: 2px;
}

.schedule-date-btn .date-count.has-count {
    display: block;
}

.schedule-date-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    background: rgba(100, 100, 100, 0.2);
}

.schedule-date-btn.disabled .date-count {
    color: #ff6b6b;
}

/* ===== Schedule Time Picker ===== */
.schedule-times {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.schedule-time-btn {
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: center;
}

.schedule-time-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.schedule-time-btn.active {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: #000;
}

.schedule-time-btn .slot-badge {
    display: block;
    font-size: 0.7rem;
    margin-top: 2px;
    opacity: 0.7;
}

.schedule-time-btn.has-matches {
    border-color: var(--accent-gold);
}

.schedule-time-btn.has-matches .slot-badge {
    color: var(--accent-gold);
}

.schedule-time-btn.active .slot-badge {
    color: inherit;
    opacity: 0.8;
}

/* Quick slots (10-min intervals for today) */
.schedule-time-btn--quick {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2) 0%, rgba(247, 147, 30, 0.2) 100%);
    border-color: rgba(255, 147, 53, 0.4);
}

.schedule-time-btn--quick:hover {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.3) 0%, rgba(247, 147, 30, 0.3) 100%);
}

.schedule-time-btn--quick.active {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    border-color: #ff6b35;
    color: #fff;
}

/* ===== Schedule Preview ===== */
.schedule-preview {
    background: none;
    border: none;
    padding: 0;
    margin-top: 4px;
    text-align: left;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.schedule-preview.visible {
    opacity: 1;
}

.schedule-preview-header {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}

.schedule-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.schedule-preview-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.schedule-preview-chip .chip-gender {
    opacity: 0.6;
}

/* ===== Schedule Results ===== */
.schedule-results-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.schedule-result-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.schedule-result-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-gold), rgba(212, 175, 55, 0.5));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.schedule-result-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.schedule-result-info {
    flex: 1;
    text-align: left;
}

.schedule-result-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 2px;
}

.schedule-result-meta {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.schedule-result-action {
    padding: 8px 16px;
    background: var(--accent-gold);
    border: none;
    border-radius: var(--radius-sm);
    color: #000;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.schedule-result-action:hover {
    background: #e6c34a;
}

/* ===== No Results ===== */
.schedule-no-results {
    text-align: center;
    padding: 30px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.no-results-hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 8px;
}

/* ===== Schedule Confirmation ===== */
.schedule-confirmation {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

/* ===== Screen Content Adjustments ===== */
.screen--wardrobe .screen-content {
    justify-content: flex-start;
    padding-top: 15px;
}

.screen--backstage .screen-content {
    justify-content: flex-start;
    padding-top: 30px;
}

/* ===== Mobile: Кнопки Далее/Назад ===== */
@media (max-width: 768px) {
    .matching-panel .btn--full {
        padding: 10px 12px !important;
        font-size: 1rem !important;
    }
}

/* ===== Notify Stage: Выбор мессенджера для уведомлений ===== */
#notify-stage {
    text-align: center;
}

#notify-stage .notify-hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.notify-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.notify-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.notify-option:hover {
    background: rgba(255, 255, 255, 0.12);
}

.notify-option:has(input:checked) {
    border-color: var(--accent-gold);
    background: rgba(212, 168, 85, 0.15);
}

.notify-option input[type="radio"] {
    display: none;
}

.notify-option .notify-icon {
    font-size: 1.5rem;
    width: 32px;
    text-align: center;
}

.notify-option .notify-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Фирменные цвета мессенджеров */
#notify-option-telegram .notify-icon {
    color: #2AABEE;
}

#notify-option-max .notify-icon {
    color: #7B68EE;
}

.notify-option .notify-label {
    flex: 1;
    text-align: left;
    font-weight: 500;
}

.notify-option .notify-status {
    color: var(--accent-gold);
    font-weight: bold;
}

/* QR секция для привязки */
.notify-link-section {
    margin: 20px 0;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
}

.notify-link-hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 12px;
}

.notify-qr-container {
    display: inline-flex;
    padding: 8px;
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.notify-qr-container canvas {
    display: block;
}

.notify-link-status {
    font-size: 0.85rem;
    color: var(--accent-gold);
}

.notify-link-status.success {
    color: #4caf50;
}
