/* ── Modal — Glass bottom sheet ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-smooth);
    padding-bottom: 50px;
}

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

.modal {
    background: var(--bg-glass-thick);
    backdrop-filter: blur(60px) saturate(200%);
    -webkit-backdrop-filter: blur(60px) saturate(200%);
    border-radius: var(--border-radius-large) var(--border-radius-large) 0 0;
    padding: var(--spacing-xl);
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--glass-highlight), var(--glass-glow), var(--shadow-elevated);
    transform: translateY(100%);
    transition: transform 0.4s var(--ease-spring);
    border: 1px solid var(--glass-border);
    border-bottom: none;
    position: relative;
}

.modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4) 20%, rgba(255, 255, 255, 0.4) 80%, transparent);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-close {
    background: var(--bg-glass-dark);
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--duration-fast) var(--ease-spring);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: scale(1.1);
}

/* ── Icon utilities ── */
.icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ── Dark theme overrides ── */
body.tg-dark-theme .bot-card,
body.tg-dark-theme .payment-card,
body.tg-dark-theme .tariff-card {
    background: var(--bg-glass-thick);
    border-color: var(--glass-border);
    box-shadow: var(--glass-highlight), var(--glass-glow), var(--shadow-light);
}

body.tg-dark-theme .bot-card:hover,
body.tg-dark-theme .tariff-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--glass-highlight), var(--glass-glow), var(--shadow-medium);
}

body.tg-dark-theme .bot-info h3,
body.tg-dark-theme .payment-amount,
body.tg-dark-theme .tariff-name,
body.tg-dark-theme .tariff-price-current,
body.tg-dark-theme .empty-state-title,
body.tg-dark-theme .modal-title {
    color: var(--text-primary);
}

body.tg-dark-theme .bot-username,
body.tg-dark-theme .bot-description,
body.tg-dark-theme .payment-description,
body.tg-dark-theme .tariff-description,
body.tg-dark-theme .empty-state-description {
    color: var(--text-secondary);
}

body.tg-dark-theme .bot-tariff {
    color: var(--color-primary);
}

body.tg-dark-theme .payment-date,
body.tg-dark-theme .tariff-price-old {
    color: var(--text-tertiary);
}

body.tg-dark-theme .tariff-card.selected {
    background: rgba(10, 132, 255, 0.1);
    border-color: var(--color-primary);
}

body.tg-dark-theme .tariff-card.admin-option {
    border: 2px solid var(--color-primary);
    background: rgba(10, 132, 255, 0.08);
}

body.tg-dark-theme .tariff-card.admin-option.selected {
    border: 2px solid var(--color-primary);
    background: rgba(10, 132, 255, 0.15);
}

body.tg-dark-theme .admin-fields {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

body.tg-dark-theme .admin-fields .form-label {
    color: var(--color-primary);
}

body.tg-dark-theme .admin-fields .form-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

body.tg-dark-theme .admin-fields .form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}

body.tg-dark-theme .admin-fields .form-help {
    color: var(--text-secondary);
}

body.tg-dark-theme .modal {
    background: var(--bg-glass-thick);
}

body.tg-dark-theme .modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

body.tg-dark-theme .loading-skeleton {
    background: linear-gradient(110deg, rgba(44, 44, 46, 0.5) 30%, rgba(58, 58, 60, 0.5) 50%, rgba(44, 44, 46, 0.5) 70%);
    background-size: 300% 100%;
}
