/* RS shared UI components */

.rs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--rs-space-2);
    min-height: var(--rs-tap);
    padding: 0 var(--rs-space-4);
    border-radius: var(--rs-radius-md);
    border: 1px solid transparent;
    font-family: inherit;
    font-size: var(--rs-text-sm);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--rs-duration) var(--rs-ease),
        border-color var(--rs-duration) var(--rs-ease),
        color var(--rs-duration) var(--rs-ease),
        transform var(--rs-duration) var(--rs-ease),
        box-shadow var(--rs-duration) var(--rs-ease);
    -webkit-tap-highlight-color: transparent;
}

.rs-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.rs-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.rs-btn--primary {
    background: var(--rs-accent);
    color: #fff;
}

.rs-btn--primary:hover:not(:disabled) {
    background: var(--rs-accent-dark);
    color: #fff;
}

.rs-btn--secondary {
    background: var(--rs-surface);
    border-color: var(--rs-border);
    color: var(--rs-text);
}

.rs-btn--secondary:hover:not(:disabled) {
    background: var(--rs-bg);
}

.rs-btn--ghost {
    background: transparent;
    color: var(--rs-muted);
}

.rs-btn--ghost:hover:not(:disabled) {
    background: rgba(10, 10, 10, 0.04);
    color: var(--rs-text);
}

.rs-btn--danger {
    background: var(--rs-danger);
    color: #fff;
}

.rs-btn--block {
    width: 100%;
}

.rs-btn--lg {
    min-height: 52px;
    font-size: var(--rs-text-md);
    padding: 0 var(--rs-space-5);
    border-radius: var(--rs-radius-pill);
}

.rs-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--rs-tap);
    padding: 0 14px;
    border-radius: var(--rs-radius-md);
    border: 1.5px solid var(--rs-border);
    background: var(--rs-surface);
    color: var(--rs-text);
    font-size: var(--rs-text-sm);
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--rs-duration) var(--rs-ease);
    -webkit-tap-highlight-color: transparent;
}

.rs-chip:hover:not(:disabled):not(.is-disabled) {
    border-color: var(--rs-accent);
}

.rs-chip.is-active {
    border-color: var(--rs-accent);
    background: var(--rs-accent-soft);
    color: var(--rs-accent-dark);
    font-weight: 600;
}

.rs-chip.is-disabled,
.rs-chip:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.rs-chip-row {
    display: flex;
    gap: var(--rs-space-2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px;
    margin: 0 -2px;
}

.rs-chip-row::-webkit-scrollbar {
    display: none;
}

.rs-stepper {
    display: flex;
    align-items: center;
    gap: var(--rs-space-3);
    background: var(--rs-surface);
    border: 1.5px solid var(--rs-border);
    border-radius: var(--rs-radius-md);
    padding: var(--rs-space-2) var(--rs-space-3);
    min-height: 56px;
}

.rs-stepper__label {
    flex: 1;
    font-size: var(--rs-text-sm);
    color: var(--rs-muted);
}

.rs-stepper__label strong {
    display: block;
    color: var(--rs-text);
    font-size: var(--rs-text-md);
    font-weight: 600;
}

.rs-stepper__btn {
    width: var(--rs-tap);
    height: var(--rs-tap);
    border-radius: var(--rs-radius-sm);
    border: 1.5px solid var(--rs-border);
    background: var(--rs-bg);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--rs-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--rs-duration) var(--rs-ease);
}

.rs-stepper__btn:hover:not(:disabled) {
    background: var(--rs-accent-soft);
    border-color: var(--rs-accent);
    color: var(--rs-accent-dark);
}

.rs-stepper__btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.rs-stepper__value {
    min-width: 2rem;
    text-align: center;
    font-size: var(--rs-text-lg);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rs-summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rs-space-2) var(--rs-space-3);
    padding: var(--rs-space-3) var(--rs-space-4);
    background: var(--rs-surface);
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius-md);
    font-size: var(--rs-text-sm);
    color: var(--rs-muted);
}

.rs-summary-strip strong {
    color: var(--rs-text);
    font-weight: 600;
}

.rs-sticky-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: var(--rs-space-3) var(--rs-space-4) calc(var(--rs-space-3) + var(--rs-safe-bottom));
    background: rgba(246, 245, 243, 0.92);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--rs-border);
}

.rs-sticky-cta__inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--rs-space-2);
}

.rs-sticky-cta__meta {
    font-size: var(--rs-text-xs);
    color: var(--rs-muted);
    text-align: center;
}

.rs-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.4);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--rs-duration-slow) var(--rs-ease);
}

.rs-sheet-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.rs-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 51;
    max-height: min(88vh, 720px);
    background: var(--rs-surface);
    border-radius: var(--rs-radius-xl) var(--rs-radius-xl) 0 0;
    box-shadow: var(--rs-shadow-lg);
    transform: translateY(100%);
    transition: transform var(--rs-duration-slow) var(--rs-ease);
    display: flex;
    flex-direction: column;
    padding-bottom: var(--rs-safe-bottom);
}

.rs-sheet.is-open {
    transform: translateY(0);
}

.rs-sheet__handle {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--rs-border);
    margin: 10px auto 0;
    flex-shrink: 0;
}

.rs-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--rs-space-3) var(--rs-space-4);
    border-bottom: 1px solid var(--rs-border);
}

.rs-sheet__title {
    font-size: var(--rs-text-md);
    font-weight: 700;
    margin: 0;
}

.rs-sheet__body {
    overflow-y: auto;
    padding: var(--rs-space-4);
    flex: 1;
}

.rs-skeleton {
    background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
    background-size: 200% 100%;
    animation: rs-shimmer 1.2s ease-in-out infinite;
    border-radius: var(--rs-radius-sm);
}

@keyframes rs-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.rs-empty {
    text-align: center;
    padding: var(--rs-space-6) var(--rs-space-4);
    color: var(--rs-muted);
}

.rs-empty__title {
    font-size: var(--rs-text-md);
    font-weight: 600;
    color: var(--rs-text);
    margin: 0 0 var(--rs-space-2);
}

.rs-empty__text {
    font-size: var(--rs-text-sm);
    margin: 0 0 var(--rs-space-4);
}

.rs-field {
    margin-bottom: var(--rs-space-4);
}

.rs-field label,
.rs-label {
    display: block;
    font-size: var(--rs-text-sm);
    font-weight: 600;
    margin-bottom: var(--rs-space-2);
    color: var(--rs-text);
}

.rs-input,
.rs-textarea {
    width: 100%;
    min-height: var(--rs-tap);
    padding: 10px 14px;
    border: 1.5px solid var(--rs-border);
    border-radius: var(--rs-radius-md);
    background: var(--rs-surface);
    font-family: inherit;
    font-size: var(--rs-text-md);
    color: var(--rs-text);
    transition: border-color var(--rs-duration) var(--rs-ease);
}

.rs-input:focus,
.rs-textarea:focus {
    outline: none;
    border-color: var(--rs-accent);
    box-shadow: 0 0 0 3px rgba(234, 91, 60, 0.18);
}

.rs-textarea {
    min-height: 96px;
    resize: vertical;
}

.rs-section-title {
    font-size: var(--rs-text-lg);
    font-weight: 700;
    margin: 0 0 var(--rs-space-2);
    letter-spacing: -0.02em;
}

.rs-section-sub {
    font-size: var(--rs-text-sm);
    color: var(--rs-muted);
    margin: 0 0 var(--rs-space-4);
}

/* Bootstrap bridge */
.btn-rs,
.btn-rs-primary {
    background: var(--rs-accent) !important;
    border-color: var(--rs-accent) !important;
    color: #fff !important;
}

.btn-rs:hover,
.btn-rs-primary:hover {
    background: var(--rs-accent-dark) !important;
    border-color: var(--rs-accent-dark) !important;
    color: #fff !important;
}

.btn-primary {
    --bs-btn-bg: var(--rs-coral);
    --bs-btn-border-color: var(--rs-coral);
    --bs-btn-hover-bg: var(--rs-coral-hover);
    --bs-btn-hover-border-color: var(--rs-coral-hover);
    --bs-btn-active-bg: var(--rs-coral-active);
    --bs-btn-active-border-color: var(--rs-coral-active);
    --bs-btn-disabled-bg: var(--rs-coral);
    --bs-btn-disabled-border-color: var(--rs-coral);
}

.btn-outline-primary {
    --bs-btn-color: var(--rs-coral);
    --bs-btn-border-color: var(--rs-coral);
    --bs-btn-hover-bg: var(--rs-coral);
    --bs-btn-hover-border-color: var(--rs-coral);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--rs-coral-active);
    --bs-btn-active-border-color: var(--rs-coral-active);
    --bs-btn-active-color: #fff;
}

.text-primary {
    color: var(--rs-coral) !important;
}

.form-check-input:checked {
    background-color: var(--rs-coral);
    border-color: var(--rs-coral);
}

.rs-settings-option {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    margin: 0;
}

.rs-settings-option .form-check-input {
    flex-shrink: 0;
    float: none;
    margin: 0.2rem 0 0;
    position: static;
}

.rs-settings-option .form-check-label {
    flex: 1 1 auto;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.rs-settings-option .input-group {
    min-width: 0;
    flex-wrap: nowrap;
}

.rs-settings-option .input-group .form-control {
    min-width: 0;
    overflow-x: auto;
    text-overflow: clip;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--rs-coral);
    box-shadow: 0 0 0 0.2rem rgba(234, 91, 60, 0.18);
}

.rs-onboarding {
    background: var(--rs-surface);
    border: 1px solid var(--rs-border);
    border-radius: var(--rs-radius-lg);
    overflow: hidden;
}

.rs-onboarding__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--rs-space-3);
    padding: var(--rs-space-4) var(--rs-space-4) var(--rs-space-3);
    background: linear-gradient(180deg, var(--rs-coral-soft) 0%, var(--rs-surface) 100%);
    border-bottom: 1px solid var(--rs-border);
}

.rs-onboarding__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--rs-text);
    margin: 0 0 var(--rs-space-1);
}

.rs-onboarding__sub {
    font-size: var(--rs-text-sm);
    color: var(--rs-muted);
}

.rs-onboarding__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    flex-shrink: 0;
}

.rs-onboarding__dismiss {
    flex-shrink: 0;
    text-decoration: none;
    padding: 0;
    line-height: 1.4;
}

.rs-onboarding__item.is-done .rs-onboarding__icon {
    color: var(--rs-success, #2f9d6a);
}

.rs-onboarding__item.is-done .rs-onboarding__label,
.rs-onboarding__item.is-done .rs-onboarding__desc {
    color: var(--rs-muted);
}

.rs-onboarding__list {
    margin: 0;
}

.rs-onboarding__item {
    border-bottom: 1px solid var(--rs-border);
}

.rs-onboarding__item:last-child {
    border-bottom: 0;
}

.rs-onboarding__link {
    display: flex;
    align-items: center;
    gap: var(--rs-space-3);
    padding: var(--rs-space-3) var(--rs-space-4);
    color: inherit;
    text-decoration: none;
    transition: background var(--rs-duration) var(--rs-ease);
}

.rs-onboarding__link:hover {
    background: var(--rs-bone);
    color: inherit;
}

.rs-onboarding__icon {
    color: var(--rs-coral);
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.rs-onboarding__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.rs-onboarding__label {
    font-weight: 600;
    font-size: var(--rs-text-sm);
    color: var(--rs-text);
}

.rs-onboarding__desc {
    font-size: 0.8125rem;
    color: var(--rs-muted);
    line-height: 1.4;
}

.rs-onboarding__chevron {
    color: var(--rs-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.rs-onboarding__footer {
    padding: var(--rs-space-2) var(--rs-space-4) var(--rs-space-3);
    background: var(--rs-bg);
    border-top: 1px solid var(--rs-border);
}
