/* ========== Settings Pages - Shared Styles ========== */

/* Loading & Error states */
.loading-container, .error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
}

.error-text {
    color: var(--tg-theme-hint-color);
    font-size: 1rem;
}

/* ========== Price Bar ========== */
.price-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.price-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.price-info, .balance-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.price-label, .balance-label {
    font-size: 0.875rem;
    color: var(--tg-theme-hint-color);
}

.price-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--tg-theme-text-color);
}

.balance-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--tg-theme-button-color);
}

/* ========== Individual Field Clear Button ========== */
.btn-field-clear {
    padding: 6px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #ce4040;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    line-height: 1.4;
}

.btn-field-clear:active {
    background: rgba(176, 80, 80, 0.12);
    color: #903030;
}

.field-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.field-hint-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ========== Upload Section ========== */
.upload-section {
    padding: var(--spacing-md);
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
}

.upload-info {
    flex: 1;
}

.btn-sm {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
}

.upload-preview {
    margin-top: var(--spacing-md);
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--tg-theme-secondary-bg-color);
}

.image-preview-img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    display: block;
    border-radius: var(--radius-md);
}

.upload-remove {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.upload-progress {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--tg-theme-secondary-bg-color);
    border-radius: var(--radius-md);
    color: var(--tg-theme-hint-color);
    font-size: 0.875rem;
}

/* ========== Required Mark ========== */
.required-mark {
    color: var(--tg-theme-hint-color);
    font-size: 0.8125rem;
    font-weight: 400;
}

/* ========== Spinner Small ========== */
.spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid var(--tg-theme-hint-color);
    border-top-color: var(--tg-theme-button-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========== Form Fixes ========== */
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slider-label {
    font-size: 0.9375rem;
    color: var(--tg-theme-text-color);
}

.card-item .form-select {
    flex-shrink: 1;
    min-width: 0;
    max-width: 50%;
}

.card-item-content {
    flex: 1 1 40%;
    min-width: 100px;
}

/* ========== Hint Button ========== */
.hint-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--tg-theme-hint-color);
    color: var(--tg-theme-bg-color);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    vertical-align: middle;
}

.hint-btn:hover,
.hint-btn:active {
    opacity: 1;
    transform: scale(1.1);
}

/* ========== Hint Popup ========== */
.hint-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    animation: settingsFadeIn 0.2s ease-out;
}

.hint-overlay.hidden {
    display: none;
}

.hint-popup {
    background: var(--tg-theme-bg-color);
    border-radius: var(--radius-lg);
    max-width: 360px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.25s ease-out;
}

@keyframes settingsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hint-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color);
}

.hint-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--tg-theme-text-color);
}

.hint-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-hint-color);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hint-body {
    padding: var(--spacing-md);
    overflow-y: auto;
    max-height: calc(80vh - 60px);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--tg-theme-text-color);
    white-space: pre-line;
}

.hint-body b {
    color: var(--tg-theme-button-color);
}
