/* ============================================================
   Custom Service Modal ("Услуга сборщика")
   ============================================================ */

/* Hide qty controls and image for service items in cart */
.cart-sidebar-item--service .cart-qty-controls,
.cart-sidebar-item--service .cart-sidebar-item-img-wrap {
    display: none;
}

/* Service item layout */
.cart-sidebar-service-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.cart-sidebar-service-left {
    flex: 1;
    min-width: 0;
}

.cart-sidebar-service-edit {
    background: none;
    border: none;
    color: #1F9356;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    margin-top: 2px;
    font-family: inherit;
    text-decoration: none;
    transition: color 0.15s;
}

.cart-sidebar-service-edit:hover {
    color: #157a45;
    text-decoration: underline;
}

.cart-sidebar-service-actions {
    display: flex;
    gap: 12px;
    margin-top: 2px;
}

.cart-sidebar-service-delete {
    background: none;
    border: none;
    color: #bbb;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    transition: color 0.15s;
}
.cart-sidebar-service-delete:hover {
    color: #e74c3c;
}

/* Trigger button — matches .cart-fsin-btn pill style */
.custom-service-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: var(--color-bg-gray, #f5f5f5);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    flex-shrink: 0;
}

.custom-service-trigger:hover {
    background: #eee;
    border-color: #d0d0d0;
}

.custom-service-trigger:active {
    background: #e5e5e5;
}

.custom-service-trigger-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: #1F9356;
}

.custom-service-trigger-label {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text, #1a1a1a);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.custom-service-trigger-chevron {
    width: 7px;
    height: 12px;
    flex-shrink: 0;
    color: var(--color-text-secondary, #6b7280);
}

/* Active state — service already in cart */
.custom-service-trigger--active {
    background: rgba(31, 147, 86, 0.08);
    border-color: rgba(31, 147, 86, 0.3);
}

.custom-service-trigger--active:hover {
    background: rgba(31, 147, 86, 0.14);
    border-color: rgba(31, 147, 86, 0.4);
}

.custom-service-trigger--active:active {
    background: rgba(31, 147, 86, 0.18);
}

.custom-service-trigger--active .custom-service-trigger-label {
    color: #1F9356;
}

.custom-service-trigger--active .custom-service-trigger-chevron {
    color: #1F9356;
}

/* Overlay */
.cs-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: csFadeIn 0.2s ease;
}

.cs-modal-overlay[hidden] {
    display: none !important;
}

@keyframes csFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Modal */
.cs-modal {
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    position: relative;
    animation: csSlideUp 0.25s ease;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.2);
}

@keyframes csSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Close */
.cs-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: background 0.15s;
}

.cs-modal-close:hover {
    background: #e5e5e5;
}

.cs-modal-close svg {
    width: 12px;
    height: 12px;
}

/* Title */
.cs-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 16px;
    padding-right: 40px;
}

/* Info text */
.cs-modal-info {
    background: #f8faf9;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
}

.cs-modal-info p {
    font-size: 13px;
    line-height: 1.6;
    color: #555;
    margin: 0 0 8px;
}

.cs-modal-info p:last-child {
    margin-bottom: 0;
}

.cs-modal-info strong {
    color: #1F9356;
}

/* Field */
.cs-modal-field {
    margin-bottom: 20px;
}

.cs-modal-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

/* Amount row — single line: input → presets → result */
.cs-amount-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cs-amount-input-wrap {
    position: relative;
    flex-shrink: 0;
}

.cs-amount-input {
    width: 120px;
    padding: 10px 30px 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #1a1a1a;
    outline: none;
    transition: border-color 0.15s;
    -moz-appearance: textfield;
}

.cs-amount-input::-webkit-inner-spin-button,
.cs-amount-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cs-amount-input:focus {
    border-color: #1F9356;
}

.cs-amount-currency {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

.cs-amount-result {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    margin-left: auto;
}

.cs-amount-result strong {
    color: #1F9356;
    font-size: 16px;
}

/* Preset buttons — inline in the row */
.cs-preset-btn {
    padding: 7px 10px;
    border-radius: 8px;
    border: 1.5px solid #e0e0e0;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.cs-preset-btn:hover {
    border-color: #1F9356;
    color: #1F9356;
}

.cs-preset-btn.active {
    border-color: #1F9356;
    background: rgba(31, 147, 86, 0.08);
    color: #1F9356;
}

/* Description textarea */
.cs-desc-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a1a;
    resize: vertical;
    min-height: 100px;
    outline: none;
    transition: border-color 0.15s;
    line-height: 1.5;
}

.cs-desc-input:focus {
    border-color: #1F9356;
}

.cs-desc-counter {
    text-align: right;
    font-size: 12px;
    color: #aaa;
    margin-top: 4px;
}

/* Submit */
.cs-modal-submit {
    width: 100%;
    padding: 14px 20px;
    border-radius: 14px;
    border: none;
    background: #1F9356;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.cs-modal-submit:hover:not(:disabled) {
    background: #1a8049;
}

.cs-modal-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cs-modal-submit--loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Success state */
.cs-modal-success {
    text-align: center;
    padding: 32px 16px;
}

.cs-modal-success svg {
    width: 48px;
    height: 48px;
    color: #1F9356;
    margin-bottom: 12px;
}

.cs-modal-success p {
    font-size: 15px;
    color: #333;
    font-weight: 500;
}

/* Mobile */
@media (max-width: 768px) {
    .cs-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .cs-modal {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        max-height: 85vh;
        padding: 24px 20px;
    }

    .cs-amount-input {
        width: 90px;
    }
}
