/* ===========================================
   New/Edit Listing - Premium Boutique Design
   Elevated with subtle animations & luxury feel
   =========================================== */

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

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

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.krpice-novi-oglas {
    max-width: 640px;
    margin: 0 auto;
    animation: formReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

/* Header */
.form-header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    position: relative;
    animation: formReveal 0.5s ease 0.1s backwards;
}

/* Decorative accent line */
.form-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 50px;
    height: 2px;
    background: linear-gradient(90deg, var(--color-accent), transparent);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--color-text-light);
    text-decoration: none;
    margin-bottom: var(--spacing-sm);
    transition: all var(--transition-base);
    padding: 4px 8px;
    margin-left: -8px;
    border-radius: var(--radius-sm);
}

.back-link::before {
    content: '←';
    font-size: 0.9rem;
    background-image: none;
    transition: transform var(--transition-bounce);
}

.back-link:hover {
    color: var(--color-primary);
    background: rgba(86, 66, 51, 0.05);
}

.back-link:hover::before {
    transform: translateX(-3px);
}

.form-header h1 {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0;
    color: var(--color-text);
    letter-spacing: -0.02em;
    font-family: var(--font-heading);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-header h1::before {
    content: '✦';
    font-size: 0.5rem;
    color: var(--color-accent);
}

/* Progress indicator (optional) */
.form-progress {
    display: flex;
    gap: 8px;
    margin-top: var(--spacing-sm);
}

.progress-step {
    flex: 1;
    height: 3px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-step.active {
    background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
}

/* Form */
.listing-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    animation: formReveal 0.5s ease 0.15s backwards;
}

/* Form Section Headers */
.form-section-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--color-surface);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title::before {
    content: '◆';
    font-size: 0.4rem;
    color: var(--color-accent);
}

/* Form Fields */
.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fieldSlideIn 0.4s ease backwards;
}

/* Staggered field animations */
.form-field:nth-child(1) { animation-delay: 0.2s; }
.form-field:nth-child(2) { animation-delay: 0.25s; }
.form-field:nth-child(3) { animation-delay: 0.3s; }
.form-field:nth-child(4) { animation-delay: 0.35s; }
.form-field:nth-child(5) { animation-delay: 0.4s; }
.form-field:nth-child(6) { animation-delay: 0.45s; }
.form-field:nth-child(7) { animation-delay: 0.5s; }
.form-field:nth-child(8) { animation-delay: 0.55s; }

.form-field label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.req {
    color: var(--color-accent);
    font-weight: 600;
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--color-text);
    background: #fff;
    transition: all var(--transition-bounce);
}

.form-field input:hover,
.form-field select:hover,
.form-field textarea:hover {
    border-color: var(--color-text-light);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(212, 163, 115, 0.12);
    background: #fff;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--color-text-light);
    opacity: 0.5;
}

.form-field textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.form-field select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 42px;
}

/* Select wrapper with chevron */
.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
}

.select-chevron {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-light);
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 1;
    transition: color 0.2s ease;
}

.select-wrapper:hover .select-chevron,
.select-wrapper select:focus + .select-chevron {
    color: var(--color-primary);
}

.field-hint {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin: 4px 0 0 0;
}

/* Input with suffix (RSD) */
.input-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-suffix input {
    padding-right: 55px;
}

.input-suffix span {
    position: absolute;
    right: 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-light);
    pointer-events: none;
    background: var(--color-surface);
    padding: 4px 8px;
    border-radius: 4px;
}

/* Form Row (2 columns) */
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

/* Photo Upload */
.photo-upload {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.photo-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.photo-item {
    width: 85px;
    height: 85px;
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-surface) 0%, #f0ebe5 100%);
    box-shadow: 0 2px 8px rgba(86, 66, 51, 0.08);
    transition: all var(--transition-bounce);
}

.photo-item:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(86, 66, 51, 0.12);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.photo-item:hover img {
    opacity: 0.85;
}

.photo-remove {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    left: auto !important;
    transform: none !important;
    width: 24px !important;
    height: 24px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: bold !important;
    font-family: Arial, sans-serif !important;
    line-height: 1 !important;
    color: #fff !important;
    text-indent: 0 !important;
    overflow: visible !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
    opacity: 0 !important;
    transition: all 0.2s ease !important;
}

.photo-item:hover .photo-remove {
    opacity: 1 !important;
}

.photo-remove::before,
.photo-remove::after {
    display: none !important;
}

.photo-remove:hover {
    background: #e74c3c !important;
    transform: scale(1.1) !important;
}

.photo-add {
    width: 85px;
    height: 85px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    background: rgba(250, 248, 245, 0.5);
    transition:
        border-color var(--transition-fast),
        background var(--transition-base),
        transform var(--transition-bounce);
}

.photo-add:hover {
    border-color: var(--color-accent);
    background: rgba(212, 163, 115, 0.08);
    transform: scale(1.03);
}

.photo-add input {
    display: none;
}

.photo-add span {
    font-size: 1.75rem;
    color: var(--color-accent);
    font-weight: 300;
    line-height: 1;
}

.photo-add small {
    font-size: 0.65rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Photo upload hint */
.photo-hint {
    font-size: 0.8rem;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.photo-hint::before {
    content: '📷';
    font-size: 0.9rem;
}

/* Condition Options */
.condition-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-field label.condition-option {
    cursor: pointer;
    display: block;
    width: 100%;
}

.condition-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.option-box {
    display: flex;
    flex-direction: column;
    padding: 16px 18px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: #fff;
    transition:
        border-color var(--transition-fast),
        background var(--transition-base),
        transform var(--transition-bounce),
        box-shadow var(--transition-base);
    position: relative;
    overflow: hidden;
}

/* Selected indicator */
.option-box::before {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: var(--color-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: #fff;
    opacity: 0;
    transform: scale(0.5);
    transition: all var(--transition-bounce);
}

.condition-option:hover .option-box {
    border-color: var(--color-accent);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(86, 66, 51, 0.1);
}

.condition-option input:checked + .option-box {
    border-color: var(--color-accent);
    background: linear-gradient(135deg, rgba(212, 163, 115, 0.08) 0%, rgba(255, 255, 255, 0.8) 100%);
    box-shadow: 0 0 0 4px rgba(212, 163, 115, 0.12);
}

.condition-option input:checked + .option-box::before {
    opacity: 1;
    transform: scale(1);
}

.option-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 4px;
}

.option-desc {
    font-size: 0.8rem;
    color: var(--color-text-light);
    line-height: 1.4;
}

/* Submit */
.form-submit {
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--color-border);
    margin-top: var(--spacing-md);
    position: relative;
}

/* Decorative accent */
.form-submit::before {
    content: '◆';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.5rem;
    color: var(--color-accent);
    background: #fff;
    padding: 0 10px;
}

.btn-submit {
    width: 100%;
    padding: 18px 32px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.0625rem;
    font-weight: 500;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: background var(--transition-base);
    letter-spacing: 0.01em;
}

.btn-submit:hover {
    background: var(--color-secondary);
}

/* Loading/Disabled state */
.btn-submit.btn-loading,
.btn-submit:disabled {
    pointer-events: none;
    opacity: 0.7;
    cursor: not-allowed;
    background: var(--color-text-light);
}

.btn-submit.btn-loading i {
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Success/Error messages */
.form-message {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: formReveal 0.3s ease;
}

.form-message.success {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1) 0%, rgba(74, 222, 128, 0.05) 100%);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: #166534;
}

.form-message.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #991b1b;
}

/* ===========================================
   Responsive
   =========================================== */

@media (max-width: 768px) {
    .krpice-novi-oglas {
        max-width: 100%;
    }

    .form-header {
        margin-bottom: var(--spacing-lg);
        padding-bottom: var(--spacing-md);
    }

    .form-header h1 {
        font-size: 1.25rem;
    }

    .listing-form {
        gap: var(--spacing-md);
    }

    .form-row-2 {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .form-field input[type="text"],
    .form-field input[type="number"],
    .form-field select,
    .form-field textarea {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 14px 16px;
    }

    /* Condition field - remove side padding for full width */
    .form-field:has(.condition-options) {
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .condition-options {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
        align-items: stretch;
    }

    .condition-options .condition-option {
        display: block;
        width: 100%;
    }

    .option-box {
        padding: 16px 12px;
        width: 100%;
        min-height: 75px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        box-sizing: border-box;
        border-radius: 10px;
        flex: 1;
    }

    .option-title {
        font-size: 0.88rem;
        font-weight: 600;
        line-height: 1.25;
    }

    .option-desc {
        font-size: 0.72rem;
        margin-top: 3px;
        opacity: 0.75;
        line-height: 1.3;
    }

    .photo-item,
    .photo-add {
        width: 75px;
        height: 75px;
    }

    .photo-item:hover img {
        opacity: 1;
    }

    .photo-item:hover .photo-remove {
        opacity: 1 !important;
    }
}

@media (max-width: 480px) {
    .form-header h1 {
        font-size: 1.1rem;
    }

    .form-field label {
        font-size: 0.85rem;
    }

    .photo-item,
    .photo-add {
        width: 68px;
        height: 68px;
    }

    .photo-remove {
        width: 20px !important;
        height: 20px !important;
        font-size: 12px !important;
    }

    .option-box {
        padding: 12px 14px;
    }

    .option-title {
        font-size: 0.9rem;
    }

    .btn-submit {
        padding: 16px 20px;
    }
}

/* ===========================================
   Accessibility - Reduced Motion
   =========================================== */

@media (prefers-reduced-motion: reduce) {
    .krpice-novi-oglas,
    .form-header,
    .listing-form,
    .form-field,
    .form-message {
        animation: none !important;
    }

    .back-link::before,
    .form-field input,
    .form-field select,
    .form-field textarea,
    .photo-item,
    .photo-add,
    .option-box,
    .option-box::before,
    .btn-submit,
    .photo-remove {
        transition: none !important;
    }

    .btn-submit::before {
        display: none;
    }

    .btn-submit.loading::after {
        animation: none;
    }
}

/* Brand Select Dropdown */
@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.brand-select-wrapper {
    position: relative;
}

.brand-select-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.brand-select-chevron {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-light);
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 1;
    transition: transform 0.2s ease, color 0.2s ease;
}

.brand-select-wrapper.open .brand-select-chevron {
    transform: translateY(-50%) rotate(180deg);
}

.brand-select-input-wrapper:focus-within .brand-select-chevron {
    color: var(--color-primary);
}

/* Hide chevron when clear button or loading is visible */
.brand-select-clear:not([style*="display: none"]) ~ .brand-select-chevron,
.brand-select-loading:not([style*="display: none"]) ~ .brand-select-chevron {
    display: none;
}

.brand-select-input-wrapper:focus-within .brand-select-icon {
    color: var(--color-primary);
}

.brand-select-input {
    width: 100%;
    padding: 14px 42px 14px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: var(--font-primary);
    background: var(--color-surface);
    color: var(--color-text);
    transition: all var(--transition-base);
}

.brand-select-input::placeholder {
    color: var(--color-text-light);
    opacity: 0.7;
}

.brand-select-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(86, 66, 51, 0.08);
    background: #fff;
}

.brand-select-clear,
.brand-select-loading {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    z-index: 2;
    border-radius: 50%;
}

.brand-select-clear:hover {
    color: var(--color-text);
    background: rgba(0, 0, 0, 0.05);
}

.brand-select-loading {
    cursor: default;
    color: var(--color-primary);
}

.brand-select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: none;
    animation: dropdownSlide 0.2s ease-out;
}

.brand-select-dropdown::-webkit-scrollbar {
    width: 5px;
}

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

.brand-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 10px;
}

.brand-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}

/* Brand options */
.brand-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--color-text);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.brand-option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--color-primary);
    transform: scaleY(0);
    transition: transform 0.15s ease;
}

.brand-option:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.brand-option:hover,
.brand-option.active {
    background: linear-gradient(90deg, rgba(86, 66, 51, 0.06) 0%, rgba(86, 66, 51, 0.02) 100%);
    color: var(--color-primary);
}

.brand-option:hover::before,
.brand-option.active::before {
    transform: scaleY(1);
}

/* Brand option with icon */
.brand-option i {
    font-size: 0.75rem;
    opacity: 0.5;
}

.brand-no-results {
    color: var(--color-text-light);
    font-style: italic;
    cursor: default;
    padding: 20px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.brand-no-results::before {
    display: none;
}

.brand-no-results i {
    font-size: 1.5rem;
    opacity: 0.3;
}

.brand-no-results:hover {
    background: transparent;
    color: var(--color-text-light);
}

/* Popular brands section */
.brand-section-title {
    padding: 10px 16px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-text-light);
    background: #f8f7f6;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand-section-title i {
    font-size: 0.6rem;
    opacity: 0.6;
}

.brand-option.popular {
    font-weight: 500;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.04) 0%, transparent 100%);
}

.brand-option.popular::after {
    content: '';
    margin-left: auto;
    width: 6px;
    height: 6px;
    background: var(--color-accent);
    border-radius: 50%;
    opacity: 0.5;
}

.brand-option.popular:hover::after {
    opacity: 1;
}

/* Brand option icon styling */
.brand-option i.fa-tag {
    font-size: 0.7rem;
    opacity: 0.35;
    transition: all 0.15s ease;
}

.brand-option:hover i.fa-tag {
    opacity: 0.6;
    color: var(--color-primary);
}

@media (max-width: 768px) {
    .brand-select-dropdown {
        max-height: 220px;
        position: fixed;
        left: 16px;
        right: 16px;
        top: auto;
        bottom: 0;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        max-height: 50vh;
    }
    
    .brand-option {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
    
    .brand-select-input {
        padding: 16px 42px 16px 42px;
    }
}

/* ===========================================
   Custom Select Dropdown (Category, Subcategory)
   =========================================== */
.custom-select-wrapper {
    position: relative;
}

.custom-select-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.custom-select-chevron {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-light);
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 1;
    transition: transform 0.2s ease, color 0.2s ease;
}

.custom-select-wrapper.open .custom-select-chevron {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-input-wrapper:focus-within .custom-select-chevron {
    color: var(--color-primary);
}

.custom-select-input {
    width: 100%;
    padding: 14px 42px 14px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-primary);
    background: #fff;
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition-base);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    text-align: left !important;
    direction: ltr !important;
    text-overflow: ellipsis;
}

/* Native select wrapper with chevron icon (Mobile) */
.select-wrapper {
    position: relative;
}

.select-wrapper select.custom-select-input {
    padding-right: 42px;
}

.select-chevron {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-light);
    font-size: 0.75rem;
    pointer-events: none;
    z-index: 1;
    transition: color 0.2s ease;
}

.select-wrapper:focus-within .select-chevron {
    color: var(--color-primary);
}

/* Responsive: Mobile vs Desktop selects */
/* Mobile: show native select, hide custom dropdown */
/* Desktop/Tablet: show custom dropdown, hide native select */

.mobile-only {
    display: block;
}

.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
    
    .desktop-only {
        display: block !important;
    }
}

.custom-select-input:read-only {
    background: #fff;
    cursor: pointer;
}

.custom-select-input::placeholder {
    color: var(--color-text-light);
    opacity: 1;
    font-style: normal;
    text-align: left;
}

.custom-select-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(212, 163, 115, 0.12);
}

.custom-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    display: none;
    animation: dropdownSlide 0.2s ease-out;
}

.custom-select-wrapper.open .custom-select-dropdown {
    display: block;
}

.custom-select-dropdown::-webkit-scrollbar {
    width: 5px;
}

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

.custom-select-dropdown::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 10px;
}

.custom-select-option {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--color-text);
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover,
.custom-select-option.active {
    background: rgba(212, 163, 115, 0.08);
}

.custom-select-option.selected {
    background: rgba(212, 163, 115, 0.12);
    font-weight: 500;
}

@media (max-width: 768px) {
    .custom-select-dropdown {
        position: fixed;
        left: 16px;
        right: 16px;
        top: auto;
        bottom: 0;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        max-height: 50vh;
    }

    .custom-select-option {
        padding: 14px 16px;
    }
}

/* ===========================================
   Color Swatches - Elegant Swatch Picker
   =========================================== */

@keyframes swatchPop {
    0% { transform: scale(0.8); opacity: 0; }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes checkBounce {
    0% { transform: scale(0) rotate(-45deg); }
    50% { transform: scale(1.2) rotate(0deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   COLOR PICKER - Atelier Palette Design
   Clean circular swatches with elegant hover tooltips
   Fashion-forward, editorial aesthetic
   ═══════════════════════════════════════════════════════════════════════════ */

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0;
}

.color-swatch {
    position: relative;
    cursor: pointer;
}

.color-swatch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* The color circle - main visual element */
.swatch-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    position: relative;
    transition: transform 0.2s ease;
}

/* Outer ring - elegant golden selection indicator */
.swatch-circle::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

/* The actual color dot */
.swatch-dot {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Color name - elegant tooltip on hover */
.swatch-name {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    padding: 4px 10px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 10;
    letter-spacing: 0.02em;
}

/* Tooltip arrow */
.swatch-name::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #fff;
}

/* Light colors - subtle border for visibility */
.color-swatch.is-light .swatch-dot {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* Multicolor gradient */
.color-swatch.is-multicolor .swatch-dot {
    background: conic-gradient(
        from 0deg,
        #ff6b6b 0deg,
        #ffd93d 60deg,
        #6bcb77 120deg,
        #4d96ff 180deg,
        #9b59b6 240deg,
        #ff6b6b 360deg
    ) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   HOVER STATE - Show tooltip, subtle lift
   ───────────────────────────────────────────────────────────────────────────── */
.color-swatch:hover .swatch-circle {
    transform: translateY(-2px);
}

.color-swatch:hover .swatch-dot {
    transform: scale(1.08);
}

.color-swatch:hover .swatch-name {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ─────────────────────────────────────────────────────────────────────────────
   SELECTED STATE - Golden ring + checkmark
   ───────────────────────────────────────────────────────────────────────────── */
.color-swatch input:checked + .swatch-circle::before {
    border-color: #b8860b;
    box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.15);
}

.color-swatch input:checked + .swatch-circle .swatch-dot {
    transform: scale(0.88);
}

/* Checkmark overlay for selected */
.color-swatch input:checked + .swatch-circle::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

/* Dark colors - white checkmark */
.color-swatch:not(.is-light) input:checked + .swatch-circle::after {
    color: #fff;
}

/* Light colors - dark checkmark */
.color-swatch.is-light input:checked + .swatch-circle::after {
    color: #333;
    text-shadow: none;
}

/* Keep tooltip visible when selected */
.color-swatch input:checked ~ .swatch-name,
.color-swatch input:checked + .swatch-circle .swatch-name {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    background: var(--color-primary, #564233);
    color: #fff;
}

.color-swatch input:checked ~ .swatch-name::before,
.color-swatch input:checked + .swatch-circle .swatch-name::before {
    border-bottom-color: var(--color-primary, #564233);
}

/* ─────────────────────────────────────────────────────────────────────────────
   FOCUS STATE (Accessibility)
   ───────────────────────────────────────────────────────────────────────────── */
.color-swatch input:focus-visible + .swatch-circle::before {
    border-color: var(--color-accent, #b8860b);
    box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.25);
}

/* ─────────────────────────────────────────────────────────────────────────────
   RESPONSIVE - Tablet & Mobile
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .color-swatches {
        gap: 10px;
    }

    .swatch-circle {
        width: 38px;
        height: 38px;
    }

    .swatch-dot {
        width: 34px;
        height: 34px;
    }

    /* Always show name on mobile (no hover) */
    .swatch-name {
        position: static;
        transform: none;
        opacity: 1;
        visibility: visible;
        display: block;
        margin-top: 6px;
        padding: 0;
        background: none;
        box-shadow: none;
        font-size: 0.65rem;
        text-align: center;
        max-width: 50px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .swatch-name::before {
        display: none;
    }

    .color-swatch {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 50px;
    }

    .color-swatch input:checked ~ .swatch-name,
    .color-swatch input:checked + .swatch-circle .swatch-name {
        background: none;
        color: var(--color-primary, #564233);
        font-weight: 600;
    }
}

@media (max-width: 480px) {
    .color-swatches {
        gap: 8px;
        justify-content: center;
    }

    .swatch-circle {
        width: 34px;
        height: 34px;
    }

    .swatch-dot {
        width: 30px;
        height: 30px;
    }

    .color-swatch {
        width: 44px;
    }

    .swatch-name {
        font-size: 0.6rem;
        max-width: 44px;
    }

    .color-swatch input:checked + .swatch-circle::after {
        font-size: 13px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .swatch-circle,
    .swatch-dot,
    .swatch-name {
        transition: none;
    }
}
