* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Protection from copying */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* Allow clicks on product images */
.product-link img,
.product-img {
    pointer-events: auto;
}

/* Allow selection in input fields */
input, textarea, select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --bg-card: #2a2a2a;
    --accent: #ff6600;
    --accent-hover: #ff8533;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: calc(45px + env(safe-area-inset-bottom, 0px));
}

.container {
    max-width: 100%;
    padding: 16px;
}

/* Header */
.header {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Search */
.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box.fixed-search {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-primary);
    padding: 12px 16px;
    margin-bottom: 0;
    border-bottom: 1px solid #333;
}

body.has-fixed-search {
    padding-top: 70px;
}

body.has-fixed-search .container {
    padding-top: 8px;
}

.search-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid #444;
    border-radius: var(--border-radius);
    padding: 14px 16px;
    padding-right: 44px;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.search-input:focus {
    border-color: var(--accent);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: var(--bg-primary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fixed-search .search-clear {
    right: 24px;
}

.search-clear:active {
    background: #444;
}

.search-header {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.search-section-title {
    font-size: 16px;
    font-weight: 600;
    margin: 16px 0 12px 0;
    padding-top: 8px;
    border-top: 1px solid #444;
}

.search-section-title:first-of-type {
    border-top: none;
    margin-top: 8px;
    padding-top: 0;
}

.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
}

/* Back button (hidden, using floating button instead) */
.back-btn {
    display: none;
}

/* Page header with back button */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 600;
}

/* Categories grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.category-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, background-color 0.15s;
    text-decoration: none;
    color: inherit;
}

.category-card:active {
    transform: scale(0.98);
    background-color: #333;
}

.category-card.full-width {
    grid-column: span 2;
}

.category-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.category-name {
    font-size: 14px;
    font-weight: 500;
}

/* Services list */
.services-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 16px;
    overflow: hidden;
}

.service-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
    margin-bottom: 10px;
}

.service-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.service-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.service-price {
    color: var(--accent);
    font-weight: 500;
}

.service-btn {
    display: block;
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.15s;
}

.service-btn:active {
    background: var(--accent-hover);
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid #444;
    border-radius: var(--border-radius-sm);
    padding: 12px;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Service info card in form */
.service-info-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 20px;
}

.service-info-card .name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.service-info-card .price {
    color: var(--accent);
    font-size: 14px;
}

/* Submit button */
.submit-btn {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, opacity 0.15s;
}

.submit-btn:active {
    background: var(--accent-hover);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Success page */
.success-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    padding: 20px;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.success-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.success-text {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
}

.success-btn {
    display: inline-block;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 14px 28px;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--text-secondary);
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-secondary);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error message */
.error-message {
    background: #ff3333;
    color: white;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
}

/* Character counter */
.char-counter {
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid #444;
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.tab:active {
    transform: scale(0.98);
}

/* Product details page */
.product-img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    background: var(--bg-secondary);
}

.product-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.3;
}

.product-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 16px;
}

.product-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-line;
}

.call-btn {
    margin-top: 20px;
}

/* Favorite button */
.favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: transform 0.15s, background 0.15s;
}

.favorite-btn:active {
    transform: scale(0.9);
}

/* Price row with favorite button */
.price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.price-row .product-price,
.price-row .price {
    margin-bottom: 0;
    line-height: 32px;
}

.favorite-btn-large {
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border: 1px solid #444;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, background 0.15s;
}

.favorite-btn-large:active {
    transform: scale(0.9);
}

.favorite-btn-large.active {
    background: rgba(255, 102, 0, 0.2);
    border-color: var(--accent);
}

.service-card {
    position: relative;
}

/* Product/Service link */
.product-link,
.service-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.product-link .service-name,
.service-link .service-name {
    color: var(--text-primary);
    transition: color 0.15s;
}

.product-link:active .service-name,
.service-link:active .service-name {
    color: var(--accent);
}

/* Service duration on detail page */
.service-duration {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

/* Favorites page */
.empty-favorites {
    text-align: center;
    padding: 60px 20px;
}

.empty-favorites .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-favorites p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.empty-favorites .service-btn {
    display: inline-block;
    width: auto;
    padding: 12px 32px;
}

/* Favorites link */
.favorites-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    padding: 12px;
    margin-bottom: 16px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: background 0.15s;
}

.favorites-link:active {
    background: #333;
}

.favorites-badge {
    background: var(--accent);
    color: white;
    font-size: 12px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* Bottom navigation bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid #444;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 4px 16px;
    padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    z-index: 100;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    transition: transform 0.15s, background 0.15s;
    position: relative;
}

.nav-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn.active {
    color: var(--accent);
}

/* Navigation tooltip */
.nav-tooltip {
    position: fixed;
    bottom: 60px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 101;
    pointer-events: none;
}

.nav-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.nav-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
}

.nav-icon-img {
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.nav-btn .nav-badge {
    position: absolute;
    top: 2px;
    right: 8px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Floating back button */
.floating-back {
    position: fixed;
    right: 16px;
    top: 100px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #ff8533;
    color: white;
    font-size: 22px;
    cursor: pointer;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(255, 102, 0, 0.4);
    touch-action: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.floating-back:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.floating-back.dragging {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 102, 0, 0.5);
}
