/* ===============================================
   STEP 3 SERVICES - ENHANCED UX IMPROVEMENTS
   =============================================== */

/* Section Titles */
.services-section-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--tg-text-color);
    display: flex;
    align-items: center;
}

.services-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Predefined Services Grid - More Compact */
.predefined-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}

.predefined-service-card {
    background: var(--tg-secondary-bg-color);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s var(--ease-out-expo);
    position: relative;
    touch-action: manipulation;
    font-size: 14px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.predefined-service-card:hover {
    border-color: var(--tg-button-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.predefined-service-card.selected {
    border-color: var(--tg-button-color);
    background: rgba(36, 129, 204, 0.1);
}

.predefined-service-card.selected::after {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: var(--tg-button-color);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.predefined-service-card.editing {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.predefined-service-card.pulse {
    animation: pulseGlow 0.6s ease-out;
}

.predefined-service-card .service-name {
    font-weight: 500;
    font-size: 13px;
    line-height: 1.3;
    margin-bottom: 8px;
}

.predefined-service-card .service-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--tg-hint-color);
    display: flex;
    align-items: center;
    min-height: 20px;
}

/* Custom Service Cards - Compact Design */
.custom-service-card {
    background: var(--tg-secondary-bg-color);
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    margin-bottom: 12px;
    position: relative;
    transition: all 0.3s ease;
    overflow: hidden;
}

.custom-service-card:hover {
    border-color: var(--tg-button-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.custom-service-card.completed {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.05);
}

.custom-service-card.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.service-card-header {
    background: rgba(0, 0, 0, 0.03);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.service-card-number {
    font-size: 12px;
    font-weight: 600;
    color: var(--tg-button-color);
}

.remove-service-btn {
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 10px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    font-weight: bold;
    touch-action: manipulation;
}

.remove-service-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.service-card-body {
    padding: 12px;
}

/* Compact Form Elements */
.form-group.compact {
    margin-bottom: 12px;
}

.form-label.compact {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--tg-text-color);
    display: block;
}

.form-input.compact {
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #d1d5db);
    transition: all 0.2s ease;
}

.form-input.compact:focus {
    border-color: var(--tg-button-color);
    box-shadow: 0 0 0 2px rgba(36, 129, 204, 0.1);
    outline: none;
}

.form-input.compact.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.05);
}

.form-row.compact {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.form-group.compact.half {
    flex: 1;
}

.price-input-container.compact {
    position: relative;
    display: flex;
    align-items: center;
}

.price-input-container.compact .form-input {
    padding-right: 28px;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', 'Monaco', monospace;
    font-variant-numeric: tabular-nums;
}

.price-input-container.compact .price-currency {
    position: absolute;
    right: 8px;
    color: var(--tg-hint-color);
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
}

.service-card-total {
    padding: 8px 12px;
    background: rgba(36, 129, 204, 0.05);
    border-radius: 6px;
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.service-card-total .total-label {
    font-size: 12px;
    color: var(--tg-hint-color);
}

.service-card-total .total-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-button-color);
}

/* Bottom Controls Section */
.services-bottom-controls {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--tg-bg-color);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 12px 0;
    margin-top: 20px;
}

/* Floating Add Button */
.add-service-button-container {
    text-align: center;
    margin-bottom: 16px;
}

.add-service-button-floating {
    background: var(--tg-button-color);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(36, 129, 204, 0.3);
    transform: translateY(0);
}

.add-service-button-floating:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(36, 129, 204, 0.4);
}

.add-service-button-floating:active {
    transform: translateY(0);
}

.add-service-button-floating.disabled {
    background: rgba(112, 117, 121, 0.7);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.add-service-button-floating .add-icon {
    font-size: 16px;
    line-height: 1;
}

.add-service-button-floating .add-text {
    font-size: 14px;
    white-space: nowrap;
}

/* Services Summary Section */
.services-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.services-counter {
    text-align: center;
}

.counter-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--tg-text-color);
    margin-bottom: 6px;
}

.counter-progress {
    width: 100%;
    height: 4px;
    background: rgba(112, 117, 121, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--tg-button-color), #3b82f6);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-bar.warning {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

/* Updated Total Display */
.total-display {
    background: linear-gradient(135deg, var(--tg-button-color), #3b82f6);
    color: white;
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    margin: 0;
}

.total-display .total-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.total-display .total-amount {
    font-size: 20px;
    font-weight: bold;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', 'Monaco', monospace;
    font-variant-numeric: tabular-nums;
}

/* Service Limit Warning - Updated Position */
.service-limit-warning {
    text-align: center;
    margin-top: 4px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(250, 204, 21, 0.14);
    color: #92400e;
    font-size: 12.5px;
    font-weight: 600;
    display: none;
}

.service-limit-warning.show {
    display: block;
}

/* Animation Classes */
.custom-service-card.new-added {
    animation: slideInUp 0.4s ease-out;
}

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

.custom-service-card.removing {
    animation: slideOutDown 0.3s ease-in forwards;
}

@keyframes slideOutDown {
    to {
        transform: translateY(20px);
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

.custom-service-card.pulse {
    animation: pulseGlow 0.6s ease-out;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
}

/* ===============================================
   CLEAN SERVICE CARDS REDESIGN - STEP 3
   =============================================== */

.is-hidden {
    display: none !important;
}

.services-card {
    background: var(--tg-bg-color);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.services-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.services-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 18px;
    background: rgba(36, 129, 204, 0.08);
    border: 1px solid rgba(36, 129, 204, 0.12);
    color: var(--tg-text-color);
}

.services-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: var(--tg-bg-color);
    box-shadow: 0 6px 16px rgba(36, 129, 204, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: var(--tg-button-color);
}

.services-hero-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.services-hero-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--tg-text-color);
    letter-spacing: -0.2px;
    line-height: 1.3;
}

.services-hero-subtitle {
    font-size: 14px;
    line-height: 1.5;
    color: var(--tg-hint-color);
    font-weight: 500;
}

.services-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding: 32px 24px;
    border-radius: 20px;
    border: 2px dashed rgba(36, 129, 204, 0.3);
    background: linear-gradient(135deg, rgba(36, 129, 204, 0.03) 0%, rgba(36, 129, 204, 0.08) 100%);
    animation: emptyStatePulse 2s ease-in-out infinite;
}

@keyframes emptyStatePulse {
    0%, 100% {
        border-color: rgba(36, 129, 204, 0.3);
        background: linear-gradient(135deg, rgba(36, 129, 204, 0.03) 0%, rgba(36, 129, 204, 0.08) 100%);
    }
    50% {
        border-color: rgba(36, 129, 204, 0.4);
        background: linear-gradient(135deg, rgba(36, 129, 204, 0.05) 0%, rgba(36, 129, 204, 0.1) 100%);
    }
}

.services-empty-state .add-service-clean {
    width: 100%;
    margin-top: 8px;
}

.empty-illustration {
    font-size: 56px;
    animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.empty-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--tg-text-color);
    letter-spacing: -0.3px;
}

.empty-subtitle {
    font-size: 15px;
    color: var(--tg-hint-color);
    line-height: 1.6;
    max-width: 280px;
}

.empty-hint {
    font-size: 13px;
    font-weight: 600;
    color: var(--tg-button-color);
    opacity: 0.8;
    margin-top: 4px;
}

.services-list-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Services Container */
.services-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

#services-list-clean,
#custom-services {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0;
}

/* Clean Service Card Design - Mobile Enhanced */
.service-card-clean {
    background: var(--tg-bg-color);
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.service-card-clean:hover {
    border-color: rgba(36, 129, 204, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.service-card-clean.service-completed {
    border-color: rgba(34, 197, 94, 0.4);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.02) 0%, rgba(34, 197, 94, 0.05) 100%);
    box-shadow: 0 2px 12px rgba(34, 197, 94, 0.15);
}

.service-card-clean.service-completed .service-number::after {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #22c55e;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    margin-left: 8px;
    vertical-align: middle;
    transform: translateY(0);
    animation: checkmarkPop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkmarkPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.service-card-clean.service-entering {
    animation: slideInDown 0.3s ease-out;
}

.service-card-clean.service-exiting {
    animation: slideOutUp 0.3s ease-in forwards;
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutUp {
    to {
        transform: translateY(-20px);
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
        padding: 0;
    }
}

/* Service Header - Enhanced Mobile Design */
.service-header {
    background: linear-gradient(135deg, rgba(36, 129, 204, 0.04) 0%, rgba(36, 129, 204, 0.08) 100%);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px solid rgba(36, 129, 204, 0.12);
}

.service-number {
    font-size: 13px;
    font-weight: 700;
    color: var(--tg-button-color);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.remove-service {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-weight: 600;
    line-height: 1;
    touch-action: manipulation;
}

.remove-service:active {
    background: #ef4444;
    color: white;
    transform: scale(0.92);
    border-color: #ef4444;
}

/* Service Content - Enhanced Spacing */
.service-content {
    padding: 18px;
}

/* Service Name Group */
.service-name-group {
    margin-bottom: 18px;
}

.service-label {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--tg-text-color);
    margin-bottom: 8px;
    text-align: left;
    letter-spacing: 0.2px;
}

.service-label.required::after {
    content: '*';
    color: #ef4444;
    margin-left: 4px;
    font-size: 14px;
}

.service-name-input-container {
    position: relative;
}

.service-name-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--tg-bg-color);
    color: var(--tg-text-color);
    font-weight: 500;
    scroll-margin: 80px; /* Space for keyboard when scrolling into view */
}

.service-name-input:focus {
    outline: none;
    border-color: var(--tg-button-color);
    background: rgba(36, 129, 204, 0.02);
    box-shadow: 0 0 0 3px rgba(36, 129, 204, 0.08);
}

.service-name-input::placeholder {
    color: var(--tg-hint-color);
    font-weight: 400;
}

/* Autocomplete Dropdown - Enhanced Mobile Design */
.service-autocomplete {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--tg-bg-color);
    border: 1.5px solid rgba(36, 129, 204, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    max-height: 320px; /* Increased from 280px to match client dropdown */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: autocompleteSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

/* Add scroll fade indicators to service autocomplete */
.service-autocomplete::before,
.service-autocomplete::after {
    content: '';
    position: sticky;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.service-autocomplete::before {
    top: 0;
    background: linear-gradient(to bottom, var(--tg-bg-color) 0%, transparent 100%);
}

.service-autocomplete::after {
    bottom: 0;
    background: linear-gradient(to top, var(--tg-bg-color) 0%, transparent 100%);
}

.service-autocomplete.has-scroll-top::before {
    opacity: 1;
}

.service-autocomplete.has-scroll-bottom::after {
    opacity: 1;
}

@keyframes autocompleteSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.autocomplete-item {
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    min-height: 62px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:active {
    background: linear-gradient(135deg, rgba(36, 129, 204, 0.1) 0%, rgba(36, 129, 204, 0.15) 100%);
}

.autocomplete-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding-right: 32px;
}

.autocomplete-item-content::after {
    content: '→';
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--tg-button-color);
    opacity: 0;
    transition: all 0.2s ease;
    pointer-events: none;
}

.autocomplete-item:active .autocomplete-item-content::after {
    opacity: 0.6;
    transform: translateY(-50%) translateX(2px);
}

.autocomplete-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--tg-text-color);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.autocomplete-price {
    font-size: 13px;
    font-weight: 500;
    color: var(--tg-button-color);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', 'Monaco', monospace;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    display: inline-block;
    word-spacing: -0.05em;
}

.autocomplete-delete-btn {
    flex-shrink: 0;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1.5px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
    touch-action: manipulation;
}

.autocomplete-delete-btn:active {
    background: #ef4444;
    color: white;
    transform: scale(0.92);
    border-color: #ef4444;
}

/* Enhanced autocomplete scrollbar styling */
.service-autocomplete::-webkit-scrollbar {
    width: 8px; /* Increased from 4px for better visibility */
}

.service-autocomplete::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    margin: 4px 0;
}

.service-autocomplete::-webkit-scrollbar-thumb {
    background: rgba(36, 129, 204, 0.4); /* More visible */
    border-radius: 4px;
    border: 2px solid var(--tg-bg-color);
    min-height: 40px;
}

.service-autocomplete::-webkit-scrollbar-thumb:hover {
    background: rgba(36, 129, 204, 0.6);
}

.service-autocomplete::-webkit-scrollbar-thumb:active {
    background: var(--tg-button-color);
}

/* Service Details Row - Enhanced Mobile Layout */
.service-details {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.service-qty-group {
    flex: 0 0 90px;
}

.service-price-group {
    flex: 1;
}

.service-qty-input,
.service-price-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--tg-bg-color);
    color: var(--tg-text-color);
    font-weight: 600;
    scroll-margin: 80px; /* Space for keyboard when scrolling into view */
}

.service-qty-input {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.service-qty-input:focus,
.service-price-input:focus {
    outline: none;
    border-color: var(--tg-button-color);
    background: rgba(36, 129, 204, 0.02);
    box-shadow: 0 0 0 3px rgba(36, 129, 204, 0.08);
}

.service-price-container {
    position: relative;
    display: flex;
    align-items: center;
}

.service-price-input {
    padding-right: 32px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', 'Monaco', monospace;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.service-price-input::placeholder {
    text-align: right;
    padding-right: 0;
}

.service-currency {
    position: absolute;
    right: 16px;
    color: var(--tg-hint-color);
    font-size: 15px;
    font-weight: 700;
    pointer-events: none;
    user-select: none;
}

/* Mobile-specific fix for price overlap */
@media (max-width: 768px) {
    .service-price-input {
        padding-right: 36px !important;
    }
}

/* Service Total - Enhanced Display */
.service-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(36, 129, 204, 0.06) 0%, rgba(36, 129, 204, 0.1) 100%);
    border-radius: 10px;
    margin-top: 4px;
    border: 1px solid rgba(36, 129, 204, 0.15);
}

.total-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--tg-text-color);
    opacity: 0.8;
}

.service-total .total-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--tg-button-color);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', 'Monaco', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.3px;
}

/* Add Service Button - Inline Design */
.add-service-inline {
    text-align: center;
    margin: 20px 0;
}

.add-service-clean {
    background: linear-gradient(135deg, var(--tg-button-color) 0%, rgba(36, 129, 204, 0.85) 100%);
    color: var(--tg-button-text-color);
    border: none;
    border-radius: 14px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(36, 129, 204, 0.3), 0 2px 8px rgba(36, 129, 204, 0.2);
    position: relative;
    overflow: hidden;
}

.add-service-clean::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.add-service-clean:active::before {
    left: 100%;
}

.add-service-clean:active {
    transform: scale(0.97);
    box-shadow: 0 4px 12px rgba(36, 129, 204, 0.25), 0 1px 4px rgba(36, 129, 204, 0.15);
}

.add-service-clean .add-icon {
    font-size: 20px;
    line-height: 1;
}

.add-service-clean:disabled,
.add-service-clean.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    background: rgba(36, 129, 204, 0.5);
}

.add-service-footer {
    width: 100%;
}

.services-footer {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 20px;
    padding: 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(36, 129, 204, 0.06) 0%, rgba(36, 129, 204, 0.1) 100%);
    border: 2px solid rgba(36, 129, 204, 0.2);
    box-shadow: 0 4px 16px rgba(36, 129, 204, 0.1);
}

.services-summary-clean {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.summary-pill {
    flex: 1 1 140px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--tg-bg-color);
    border: 1.5px solid rgba(36, 129, 204, 0.2);
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.summary-pill .summary-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--tg-hint-color);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.9;
}

.summary-pill .summary-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--tg-text-color);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', 'Monaco', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2px;
}

.summary-pill-total {
    border-color: rgba(36, 129, 204, 0.35);
    background: linear-gradient(135deg, rgba(36, 129, 204, 0.12) 0%, rgba(36, 129, 204, 0.18) 100%);
}

.summary-pill-total .summary-value {
    color: var(--tg-button-color);
    font-size: 20px;
}

/* ===============================================
   AUTOCOMPLETE DROPDOWN
   =============================================== */

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--tg-bg-color);
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
}

.autocomplete-item {
    padding: 0;
    transition: background-color 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: rgba(36, 129, 204, 0.05);
}

.suggestion-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
}

.suggestion-text {
    flex: 1;
}

.suggestion-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--tg-text-color);
    margin-bottom: 2px;
}

.suggestion-price {
    font-size: 12px;
    color: var(--tg-hint-color);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', 'Monaco', monospace;
    font-variant-numeric: tabular-nums;
}

.suggestion-delete {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.2s ease;
    margin-left: 12px;
}

/* ===============================================
   CLIENT REQUISITES DROPDOWN - STEP 1
   =============================================== */

/* Container for input + dropdown */
.client-name-input-container {
    position: relative;
    width: 100%;
}

/* Dropdown container */
.client-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--tg-bg-color);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    max-height: 170px; /* Shows 2.5 items accounting for actual content height (~68px per item) */
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    -webkit-overflow-scrolling: touch;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* Ensure scrolling works on all mobile devices */
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

/* Add scroll fade indicators to show more content exists */
.client-dropdown::before,
.client-dropdown::after {
    content: '';
    position: sticky;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.client-dropdown::before {
    top: 0;
    background: linear-gradient(to bottom, var(--tg-bg-color) 0%, transparent 100%);
}

.client-dropdown::after {
    bottom: 0;
    background: linear-gradient(to top, var(--tg-bg-color) 0%, transparent 100%);
}

/* Show scroll indicators when content overflows */
.client-dropdown.has-scroll-top::before {
    opacity: 1;
}

.client-dropdown.has-scroll-bottom::after {
    opacity: 1;
}

/* Visual scroll hint that appears on initial display */
.client-dropdown.show-scroll-hint::after {
    opacity: 1;
    animation: scrollHintPulse 2s ease-in-out;
}

@keyframes scrollHintPulse {
    0%, 100% {
        opacity: 0;
    }
    10%, 50% {
        opacity: 1;
    }
    90% {
        opacity: 0.5;
    }
}

/* Dropdown item */
.client-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 56px; /* Reduced from 62px for more compact display */
    touch-action: manipulation;
    max-width: 100%;
}

.client-dropdown-item:last-child {
    border-bottom: none;
}

.client-dropdown-item:hover,
.client-dropdown-item.keyboard-selected {
    background: var(--tg-secondary-bg-color);
    transform: translateX(2px);
}

.client-dropdown-item:active {
    background: rgba(36, 129, 204, 0.1);
    transform: scale(0.98);
}

/* Dropdown content */
.client-dropdown-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.client-dropdown-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--tg-text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-dropdown-bin {
    font-size: 13px;
    color: var(--tg-hint-color);
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
}

/* Delete button */
.client-dropdown-delete {
    flex-shrink: 0;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 12px;
    touch-action: manipulation;
}

.client-dropdown-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}

.client-dropdown-delete:active {
    transform: scale(0.95);
    background: rgba(239, 68, 68, 0.3);
}

/* Enhanced scrollbar styling for better visibility */
.client-dropdown::-webkit-scrollbar {
    width: 8px; /* Increased from 6px for better visibility */
}

.client-dropdown::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    margin: 4px 0; /* Add margin to keep scrollbar away from edges */
}

.client-dropdown::-webkit-scrollbar-thumb {
    background: rgba(36, 129, 204, 0.4); /* More visible blue color */
    border-radius: 4px;
    border: 2px solid var(--tg-bg-color); /* Create padding effect */
    min-height: 40px; /* Ensure thumb is always grabbable */
}

.client-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(36, 129, 204, 0.6); /* Brighter on hover */
}

.client-dropdown::-webkit-scrollbar-thumb:active {
    background: var(--tg-button-color); /* Full color when dragging */
}

/* Mobile-specific adjustments for smaller screens */
@media (max-width: 480px) {
    .client-dropdown {
        max-height: 170px; /* Shows 2.5 items accounting for actual content height (~68px per item) */
        border-radius: 10px;
    }

    .client-dropdown-item {
        padding: 11px 12px; /* Slightly reduce padding for more compact display */
        min-height: 54px; /* Reduced from 58px to fit more items */
    }

    .client-dropdown-name {
        font-size: 14px;
    }

    .client-dropdown-bin {
        font-size: 12px;
    }

    .client-dropdown-delete {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 18px;
    }
}

/* Extra small screens (iPhone SE 1st gen, etc.) */
@media (max-width: 360px) {
    .client-dropdown {
        max-height: 165px; /* Shows 2.5 items accounting for actual content height (~66px per item) */
    }

    .client-dropdown-item {
        padding: 10px 11px;
        min-height: 52px; /* Further reduced for maximum items visible */
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .client-dropdown {
        background: var(--tg-secondary-bg-color);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .client-dropdown::before {
        background: linear-gradient(to bottom, var(--tg-secondary-bg-color) 0%, transparent 100%);
    }

    .client-dropdown::after {
        background: linear-gradient(to top, var(--tg-secondary-bg-color) 0%, transparent 100%);
    }

    .client-dropdown-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .client-dropdown-item:hover,
    .client-dropdown-item.keyboard-selected {
        background: rgba(255, 255, 255, 0.05);
    }

    .client-dropdown::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
    }

    .client-dropdown::-webkit-scrollbar-thumb {
        background: rgba(36, 129, 204, 0.5);
        border-color: var(--tg-secondary-bg-color);
    }
}

/* ===== SELLER DROPDOWN STYLES (Step 4) ===== */

/* Seller requisites textarea - taller for more fields (bank, IIK, BIK, etc.) */
#seller-requisites-text {
    min-height: 160px; /* Adjusted to be slightly smaller */
    max-height: 400px; /* Prevent excessive growth */
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto; /* Enable scrolling when needed */
    scroll-behavior: smooth;
}

/* Make it much taller on desktop since there's more screen space */
@media (min-width: 768px) {
    #seller-requisites-text {
        min-height: 240px; /* Reduced from 320px */
    }
}

@media (min-width: 1024px) {
    #seller-requisites-text {
        min-height: 280px; /* Reduced from 380px */
    }
}

/* Clear requisites button */
.clear-requisites-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 16px; /* Space below button, above textarea */
    padding: 14px 20px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    position: relative;
    z-index: 101; /* Above dropdown (which is z-index: 100) */
}

.clear-requisites-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.clear-requisites-btn:active {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(0);
}

.clear-icon {
    font-size: 18px;
    font-weight: 700;
}

.clear-text {
    line-height: 1.2;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .clear-requisites-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Seller name input container for dropdown positioning */
.seller-name-input-container {
    position: relative;
    width: 100%;
}

/* Dropdown container */
.seller-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--tg-bg-color);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
    max-height: 180px; /* Shows ~2.5 items to hint at scrollability */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

/* Add scroll fade indicators to show more content exists */
.seller-dropdown::before,
.seller-dropdown::after {
    content: '';
    position: sticky;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.seller-dropdown::before {
    top: 0;
    background: linear-gradient(to bottom, var(--tg-bg-color) 0%, transparent 100%);
}

.seller-dropdown::after {
    bottom: 0;
    background: linear-gradient(to top, var(--tg-bg-color) 0%, transparent 100%);
}

/* Show scroll indicators when content overflows */
.seller-dropdown.has-scroll-top::before {
    opacity: 1;
}

.seller-dropdown.has-scroll-bottom::after {
    opacity: 1;
}

/* Visual scroll hint that appears on initial display */
.seller-dropdown.show-scroll-hint::after {
    opacity: 1;
    animation: scrollHintPulse 2s ease-in-out;
}

/* Dropdown item */
.seller-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 56px; /* Reduced from 62px for more compact display */
    touch-action: manipulation;
    max-width: 100%;
}

.seller-dropdown-item:last-child {
    border-bottom: none;
}

.seller-dropdown-item:hover,
.seller-dropdown-item.keyboard-selected {
    background: var(--tg-secondary-bg-color);
    transform: translateX(2px);
}

.seller-dropdown-item:active {
    background: rgba(36, 129, 204, 0.1);
    transform: scale(0.98);
}

/* Dropdown content */
.seller-dropdown-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.seller-dropdown-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--tg-text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seller-dropdown-bin {
    font-size: 13px;
    color: var(--tg-hint-color);
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
}

/* Delete button */
.seller-dropdown-delete {
    flex-shrink: 0;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 12px;
    touch-action: manipulation;
}

.seller-dropdown-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}

.seller-dropdown-delete:active {
    transform: scale(0.95);
    background: rgba(239, 68, 68, 0.3);
}

/* Enhanced scrollbar styling for better visibility */
.seller-dropdown::-webkit-scrollbar {
    width: 8px; /* Increased from 6px for better visibility */
}

.seller-dropdown::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    margin: 4px 0; /* Add margin to keep scrollbar away from edges */
}

.seller-dropdown::-webkit-scrollbar-thumb {
    background: rgba(36, 129, 204, 0.4); /* More visible blue color */
    border-radius: 4px;
    border: 2px solid var(--tg-bg-color); /* Create padding effect */
    min-height: 40px; /* Ensure thumb is always grabbable */
}

.seller-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(36, 129, 204, 0.6); /* Brighter on hover */
}

.seller-dropdown::-webkit-scrollbar-thumb:active {
    background: var(--tg-button-color); /* Full color when dragging */
}

/* Mobile-specific adjustments for smaller screens */
@media (max-width: 480px) {
    .seller-dropdown {
        max-height: 170px; /* Shows 2.5 items accounting for actual content height (~68px per item) */
        border-radius: 10px;
    }

    .seller-dropdown-item {
        padding: 11px 12px; /* Slightly reduce padding for more compact display */
        min-height: 54px; /* Reduced from 58px to fit more items */
    }

    .seller-dropdown-name {
        font-size: 14px;
    }

    .seller-dropdown-bin {
        font-size: 12px;
    }

    .seller-dropdown-delete {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 18px;
    }
}

/* Extra small screens (iPhone SE 1st gen, etc.) */
@media (max-width: 360px) {
    .seller-dropdown {
        max-height: 165px; /* Shows 2.5 items accounting for actual content height (~66px per item) */
    }

    .seller-dropdown-item {
        padding: 10px 11px;
        min-height: 52px; /* Further reduced for maximum items visible */
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .seller-dropdown {
        background: var(--tg-secondary-bg-color);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .seller-dropdown::before {
        background: linear-gradient(to bottom, var(--tg-secondary-bg-color) 0%, transparent 100%);
    }

    .seller-dropdown::after {
        background: linear-gradient(to top, var(--tg-secondary-bg-color) 0%, transparent 100%);
    }

    .seller-dropdown-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .seller-dropdown-item:hover,
    .seller-dropdown-item.keyboard-selected {
        background: rgba(255, 255, 255, 0.05);
    }

    .seller-dropdown::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
    }

    .seller-dropdown::-webkit-scrollbar-thumb {
        background: rgba(36, 129, 204, 0.5);
        border-color: var(--tg-secondary-bg-color);
    }
}
