/* Telegram-like Mini App Styles */

:root {
    --tg-theme-bg-color: #ffffff;
    --tg-theme-text-color: #000000;
    --tg-theme-hint-color: #999999;
    --tg-theme-link-color: #2481cc;
    --tg-theme-button-color: #2481cc;
    --tg-theme-button-text-color: #ffffff;
    --tg-theme-secondary-bg-color: #f4f4f5;
}

* {
    box-sizing: border-box;
}

html {
    display: flex;
    justify-content: center;
    background-color: #1a1a1a;
    min-height: 100vh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--tg-theme-secondary-bg-color);
    color: var(--tg-theme-text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    max-width: 400px;
}

/* Search */
.search-input-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tg-theme-hint-color);
    font-size: 1rem;
    pointer-events: none;
}

.search-input {
    padding-left: 38px !important;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.search-input:focus {
    border-color: var(--tg-theme-button-color);
    box-shadow: 0 0 0 3px rgba(36, 129, 204, 0.15);
}

/* Product snippets */
.search-results {
    margin-bottom: 1rem;
}

.product-snippet {
    display: flex;
    gap: 14px;
    padding: 12px;
    background: var(--tg-theme-bg-color);
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    color: inherit;
    text-decoration: none;
}

.product-snippet:active {
    opacity: 0.9;
}

.product-snippet-image {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--tg-theme-secondary-bg-color);
}

.product-snippet-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-snippet-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-theme-hint-color);
    font-size: 1.5rem;
}

.product-snippet-body {
    flex: 1;
    min-width: 0;
}

.product-snippet-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.product-snippet-price {
    color: var(--tg-theme-button-color);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.product-snippet-desc {
    font-size: 13px;
    color: var(--tg-theme-hint-color);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Product detail page */
.product-detail-image {
    position: relative;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 12px;
    overflow: hidden;
}

.product-detail-image img {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
    vertical-align: top;
}

.product-detail-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-theme-hint-color);
    font-size: 4rem;
}

.product-detail-description {
    font-size: 15px;
    line-height: 1.5;
}

/* HTML-контент товара: картинки и текст не выходят за границы */
.product-detail-html-content {
    overflow-wrap: break-word;
    overflow-x: hidden;
}

.product-detail-html-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

.product-detail-html-content iframe,
.product-detail-html-content video {
    max-width: 100%;
}

/* Categories */
.categories-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-btn {
    display: block;
    padding: 14px 16px;
    background: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    text-decoration: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: background 0.2s;
}

.category-btn:active {
    background: var(--tg-theme-secondary-bg-color);
}

/* Cards */
.card {
    background: var(--tg-theme-bg-color);
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.card-body {
    padding: 16px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-text {
    font-size: 14px;
    line-height: 1.4;
}

/* Step Number Badge */
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--tg-theme-button-color);
    color: var(--tg-theme-button-text-color);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
}

/* Step Blocks */
.step-block {
    margin-bottom: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: none;
}

.step-block.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.step-block.hiding {
    opacity: 0;
    transform: translateY(-10px);
}

/* Form Controls */
.form-control {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    border-color: var(--tg-theme-button-color);
    box-shadow: 0 0 0 3px rgba(36, 129, 204, 0.15);
    outline: none;
}

.form-control::placeholder {
    color: var(--tg-theme-hint-color);
}

/* Suggestions Dropdown */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--tg-theme-bg-color);
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.suggestions-dropdown.show {
    display: block;
}

.suggestion-item {
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suggestion-item:hover,
.suggestion-item:focus {
    background: var(--tg-theme-secondary-bg-color);
}

.suggestion-item:first-child {
    border-radius: 10px 10px 0 0;
}

.suggestion-item:last-child {
    border-radius: 0 0 10px 10px;
}

.suggestion-item:only-child {
    border-radius: 10px;
}

.suggestion-breed {
    font-weight: 500;
}

.suggestion-fur {
    font-size: 12px;
    color: var(--tg-theme-hint-color);
    background: var(--tg-theme-secondary-bg-color);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 14px;
    background: var(--tg-theme-secondary-bg-color);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    margin: 0;
}

.radio-option:active {
    transform: scale(0.98);
}

.radio-option input[type="radio"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #c4c4c4;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    transition: border-color 0.2s ease;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked {
    border-color: var(--tg-theme-button-color);
}

.radio-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--tg-theme-button-color);
    border-radius: 50%;
}

.radio-option.selected {
    background: rgba(36, 129, 204, 0.1);
}

.radio-label {
    font-size: 15px;
    font-weight: 500;
}

/* Buttons */
.btn-primary {
    background: var(--tg-theme-button-color);
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover {
    background: var(--tg-theme-button-color);
    opacity: 0.9;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
}

/* Success Icon */
.success-icon {
    width: 64px;
    height: 64px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
}

/* Loading Spinner */
.spinner-border {
    width: 40px;
    height: 40px;
}

/* Scrollbar */
.suggestions-dropdown::-webkit-scrollbar {
    width: 4px;
}

.suggestions-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.suggestions-dropdown::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 4px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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