/**
 * HM Classifieds — Post-an-Ad Form Styles
 *
 * Multi-step form with photo upload, price type cards, toggle switches,
 * and review preview. Mobile-first with warm community aesthetic.
 *
 * @layer components
 * @package HM_Classifieds
 */

/* Note: No @layer wrapper — see classifieds-shared.css for explanation. */

/* ==========================================================================
   FORM AUTH GATE
   ========================================================================== */

.hm-form-auth {
    max-width: 420px;
    margin: var(--spacing-16, 4rem) auto;
    text-align: center;
    padding: var(--spacing-8, 2rem);
}

.hm-form-auth__icon {
    font-size: 3rem;
    color: var(--hm-primary-600, #b45309);
    margin-bottom: var(--spacing-4, 1rem);
}

.hm-form-auth h2 {
    font-family: var(--font-heading, 'DM Serif Display', serif);
    font-size: var(--text-2xl, 1.5rem);
    margin-bottom: var(--spacing-2, 0.5rem);
}

.hm-form-auth p {
    color: var(--hm-neutral-500, #64748b);
    margin-bottom: var(--spacing-6, 1.5rem);
}

/* ==========================================================================
   FORM WRAPPER
   ========================================================================== */

.hm-post-form {
    max-width: 680px;
    margin: 0 auto;
    padding: var(--spacing-4, 1rem);
}

@media (min-width: 768px) {
    .hm-post-form {
        padding: var(--spacing-8, 2rem) var(--spacing-4, 1rem);
    }
}

/* ==========================================================================
   PROGRESS INDICATOR
   ========================================================================== */

.hm-post-form__progress {
    margin-bottom: var(--spacing-8, 2rem);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.hm-post-form__progress::-webkit-scrollbar { display: none; }

.hm-post-form__steps {
    display: flex;
    align-items: center;
    gap: 0;
    min-width: 420px;
    padding: 0 var(--spacing-2, 0.5rem);
}

.hm-post-form__step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--spacing-2, 0.5rem);
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.hm-post-form__step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm, 0.875rem);
    background: var(--hm-neutral-100, #f1f5f9);
    color: var(--hm-neutral-400, #94a3b8);
    border: 2px solid var(--hm-neutral-200, #e2e8f0);
    transition: all 0.3s ease;
}

.hm-post-form__step-label {
    font-size: var(--text-xs, 0.75rem);
    color: var(--hm-neutral-400, #94a3b8);
    font-weight: 500;
    transition: color 0.3s;
}

.hm-post-form__step--active .hm-post-form__step-num {
    background: var(--hm-primary-600, #b45309);
    color: #fff;
    border-color: var(--hm-primary-600, #b45309);
}

.hm-post-form__step--active .hm-post-form__step-label {
    color: var(--hm-primary-700, #92400e);
    font-weight: 600;
}

.hm-post-form__step--done .hm-post-form__step-num {
    background: var(--hm-success-600, #16a34a);
    color: #fff;
    border-color: var(--hm-success-600, #16a34a);
}

.hm-post-form__step--done .hm-post-form__step-label {
    color: var(--hm-success-700, #15803d);
}

.hm-post-form__step-line {
    flex: 1;
    height: 2px;
    background: var(--hm-neutral-200, #e2e8f0);
    min-width: 20px;
    transition: background 0.3s;
}

.hm-post-form__step-line--done {
    background: var(--hm-success-500, #22c55e);
}

/* ==========================================================================
   FORM PANELS
   ========================================================================== */

.hm-post-form__panel {
    display: none;
    animation: hmFormFadeIn 0.3s ease;
}

.hm-post-form__panel--active {
    display: block;
}

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

/* Step titles */
.hm-step__title {
    font-family: var(--font-heading, 'DM Serif Display', serif);
    font-size: var(--text-2xl, 1.5rem);
    color: var(--hm-neutral-900, #0f172a);
    margin: 0 0 var(--spacing-1, 0.25rem);
}

.hm-step__subtitle {
    color: var(--hm-neutral-500, #64748b);
    font-size: var(--text-sm, 0.875rem);
    margin: 0 0 var(--spacing-6, 1.5rem);
}

/* ==========================================================================
   FORM FIELDS
   ========================================================================== */

.hm-form-field {
    margin-bottom: var(--spacing-5, 1.25rem);
}

.hm-form-field__label {
    display: block;
    font-weight: 600;
    font-size: var(--text-sm, 0.875rem);
    color: var(--hm-neutral-700, #334155);
    margin-bottom: var(--spacing-1, 0.25rem);
}

.hm-form-field__required {
    color: var(--hm-danger-500, #ef4444);
}

.hm-form-field__input,
.hm-form-field__textarea,
.hm-form-field__select {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: var(--text-base, 1rem);
    font-family: inherit;
    color: var(--hm-neutral-900, #0f172a);
    background: var(--hm-bg, #fdfcfa);
    border: 1.5px solid var(--hm-neutral-200, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

.hm-form-field__input:focus,
.hm-form-field__textarea:focus,
.hm-form-field__select:focus {
    outline: none;
    border-color: var(--hm-primary-500, #d97706);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.hm-form-field__input::placeholder,
.hm-form-field__textarea::placeholder {
    color: var(--hm-neutral-400, #94a3b8);
}

.hm-form-field__textarea {
    resize: vertical;
    min-height: 100px;
}

.hm-form-field__select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.hm-form-field__counter {
    display: block;
    text-align: right;
    font-size: var(--text-xs, 0.75rem);
    color: var(--hm-neutral-400, #94a3b8);
    margin-top: 4px;
}

.hm-form-field__hint {
    display: block;
    font-size: var(--text-xs, 0.75rem);
    color: var(--hm-neutral-400, #94a3b8);
    margin-top: 4px;
}

.hm-form-field__input--error,
.hm-form-field__textarea--error,
.hm-form-field__select--error {
    border-color: var(--hm-danger-500, #ef4444);
}

.hm-form-field__error-msg {
    font-size: var(--text-xs, 0.75rem);
    color: var(--hm-danger-500, #ef4444);
    margin-top: 4px;
}

/* ==========================================================================
   PHOTO UPLOAD
   ========================================================================== */

.hm-photo-upload__dropzone {
    border: 2px dashed var(--hm-neutral-300, #cbd5e1);
    border-radius: var(--radius-lg, 12px);
    padding: var(--spacing-8, 2rem) var(--spacing-4, 1rem);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--hm-neutral-50, #f8fafc);
}

.hm-photo-upload__dropzone:hover,
.hm-photo-upload__dropzone--drag-over {
    border-color: var(--hm-primary-500, #d97706);
    background: rgba(217, 119, 6, 0.04);
}

.hm-photo-upload__icon {
    color: var(--hm-neutral-400, #94a3b8);
    margin-bottom: var(--spacing-3, 0.75rem);
}

.hm-photo-upload__text {
    color: var(--hm-neutral-600, #475569);
    margin: 0 0 var(--spacing-1, 0.25rem);
}

.hm-photo-upload__browse {
    background: none;
    border: none;
    color: var(--hm-primary-600, #b45309);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
    padding: 0;
}

.hm-photo-upload__hint {
    font-size: var(--text-xs, 0.75rem);
    color: var(--hm-neutral-400, #94a3b8);
    margin: 0;
}

.hm-photo-upload__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: var(--spacing-2, 0.5rem);
    margin-top: var(--spacing-4, 1rem);
}

@media (min-width: 640px) {
    .hm-photo-upload__grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

.hm-photo-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: grab;
    transition: border-color 0.2s;
}

.hm-photo-thumb:first-child {
    border-color: var(--hm-primary-500, #d97706);
}

.hm-photo-thumb:first-child::after {
    content: 'Cover';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--hm-primary-600, #b45309);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    padding: 2px;
    letter-spacing: 0.05em;
}

.hm-photo-thumb__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hm-photo-thumb__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.hm-photo-thumb:hover .hm-photo-thumb__remove {
    opacity: 1;
}

.hm-photo-thumb--uploading {
    opacity: 0.5;
}

.hm-photo-thumb--uploading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.6);
    z-index: 1;
}

.hm-photo-upload__counter {
    font-size: var(--text-sm, 0.875rem);
    color: var(--hm-neutral-500, #64748b);
    margin-top: var(--spacing-2, 0.5rem);
}

.hm-step-photos__tips {
    margin-top: var(--spacing-6, 1.5rem);
    padding: var(--spacing-4, 1rem);
    background: var(--hm-neutral-50, #f8fafc);
    border-radius: var(--radius-md, 8px);
    border-left: 3px solid var(--hm-primary-500, #d97706);
}

.hm-step-photos__tips h4 {
    font-size: var(--text-sm, 0.875rem);
    color: var(--hm-primary-700, #92400e);
    margin: 0 0 var(--spacing-2, 0.5rem);
}

.hm-step-photos__tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hm-step-photos__tips li {
    font-size: var(--text-sm, 0.875rem);
    color: var(--hm-neutral-600, #475569);
    padding: 2px 0;
}

.hm-step-photos__tips li::before {
    content: '✓ ';
    color: var(--hm-success-600, #16a34a);
    font-weight: 600;
}

/* ==========================================================================
   PRICE TYPE CARDS
   ========================================================================== */

.hm-price-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-3, 0.75rem);
    margin-bottom: var(--spacing-6, 1.5rem);
}

@media (min-width: 640px) {
    .hm-price-type-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.hm-price-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-2, 0.5rem);
    padding: var(--spacing-4, 1rem) var(--spacing-2, 0.5rem);
    border: 2px solid var(--hm-neutral-200, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    background: var(--hm-bg, #fdfcfa);
}

.hm-price-type-card:hover {
    border-color: var(--hm-primary-300, #fbbf24);
    background: rgba(217, 119, 6, 0.03);
}

.hm-price-type-card--active {
    border-color: var(--hm-primary-600, #b45309);
    background: rgba(217, 119, 6, 0.06);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.hm-price-type-card__icon {
    color: var(--hm-neutral-400, #94a3b8);
    transition: color 0.2s;
}

.hm-price-type-card--active .hm-price-type-card__icon {
    color: var(--hm-primary-600, #b45309);
}

.hm-price-type-card__label {
    font-weight: 700;
    font-size: var(--text-sm, 0.875rem);
    color: var(--hm-neutral-900, #0f172a);
}

.hm-price-type-card__desc {
    font-size: var(--text-xs, 0.75rem);
    color: var(--hm-neutral-500, #64748b);
}

/* Price input */
.hm-price-input-wrap {
    margin-top: var(--spacing-4, 1rem);
}

.hm-price-input {
    position: relative;
    max-width: 240px;
}

.hm-price-input__symbol {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--text-xl, 1.25rem);
    font-weight: 700;
    color: var(--hm-neutral-400, #94a3b8);
    pointer-events: none;
}

.hm-price-input .hm-price-input__field {
    display: block;
    width: 100%;
    padding: 12px 14px 12px 42px;
    font-size: var(--text-2xl, 1.5rem);
    font-weight: 700;
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    color: var(--hm-neutral-900, #0f172a);
    background: var(--hm-bg, #fdfcfa);
    border: 1.5px solid var(--hm-neutral-200, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    -moz-appearance: textfield;
}

.hm-price-input__field::-webkit-inner-spin-button,
.hm-price-input__field::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hm-price-input__field:focus {
    outline: none;
    border-color: var(--hm-primary-500, #d97706);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

/* ==========================================================================
   RADIO CARDS (Location Display)
   ========================================================================== */

.hm-radio-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-2, 0.5rem);
}

@media (max-width: 480px) {
    .hm-radio-group {
        grid-template-columns: 1fr;
    }
}

.hm-radio-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--spacing-3, 0.75rem);
    border: 2px solid var(--hm-neutral-200, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.hm-radio-card:hover {
    border-color: var(--hm-primary-300, #fbbf24);
}

.hm-radio-card--active {
    border-color: var(--hm-primary-600, #b45309);
    background: rgba(217, 119, 6, 0.04);
}

.hm-radio-card input { position: absolute; opacity: 0; }

.hm-radio-card__label {
    font-weight: 600;
    font-size: var(--text-sm, 0.875rem);
    color: var(--hm-neutral-900, #0f172a);
}

.hm-radio-card__desc {
    font-size: var(--text-xs, 0.75rem);
    color: var(--hm-neutral-500, #64748b);
}

/* ==========================================================================
   TOGGLE SWITCHES
   ========================================================================== */

.hm-form-toggles {
    border-top: 1px solid var(--hm-neutral-200, #e2e8f0);
    padding-top: var(--spacing-4, 1rem);
}

.hm-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-4, 1rem);
    padding: var(--spacing-3, 0.75rem) 0;
    cursor: pointer;
    border-bottom: 1px solid var(--hm-neutral-100, #f1f5f9);
}

.hm-toggle-row__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hm-toggle-row__info strong {
    font-size: var(--text-sm, 0.875rem);
    color: var(--hm-neutral-900, #0f172a);
}

.hm-toggle-row__info span {
    font-size: var(--text-xs, 0.75rem);
    color: var(--hm-neutral-500, #64748b);
}

.hm-toggle-row__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.hm-toggle-row__switch {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    background: var(--hm-neutral-300, #cbd5e1);
    border-radius: 12px;
    transition: background 0.2s;
}

.hm-toggle-row__switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.hm-toggle-row__input:checked + .hm-toggle-row__switch {
    background: var(--hm-primary-600, #b45309);
}

.hm-toggle-row__input:checked + .hm-toggle-row__switch::after {
    transform: translateX(20px);
}

/* ==========================================================================
   REVIEW CARD
   ========================================================================== */

.hm-review-card {
    border: 1px solid var(--hm-neutral-200, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    background: var(--hm-bg, #fdfcfa);
}

.hm-review-card__photos {
    aspect-ratio: 16/9;
    background: var(--hm-neutral-100, #f1f5f9);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hm-review-card__photos img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hm-review-card__no-photo {
    color: var(--hm-neutral-400, #94a3b8);
    text-align: center;
}

.hm-review-card__no-photo i {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--spacing-2, 0.5rem);
}

.hm-review-card__body {
    padding: var(--spacing-4, 1rem);
}

.hm-review-card__section {
    padding: var(--spacing-3, 0.75rem) 0;
    border-bottom: 1px solid var(--hm-neutral-100, #f1f5f9);
}

.hm-review-card__section:last-child { border-bottom: none; }

.hm-review-card__section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-2, 0.5rem);
}

.hm-review-card__section-head h3 {
    font-size: var(--text-sm, 0.875rem);
    font-weight: 700;
    color: var(--hm-neutral-700, #334155);
    margin: 0;
}

.hm-review-card__edit {
    background: none;
    border: none;
    color: var(--hm-primary-600, #b45309);
    font-size: var(--text-xs, 0.75rem);
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm, 4px);
    transition: background 0.2s;
}

.hm-review-card__edit:hover {
    background: rgba(180, 83, 9, 0.08);
}

.hm-review-card__row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 4px 0;
    gap: var(--spacing-4, 1rem);
}

.hm-review-card__label {
    font-size: var(--text-sm, 0.875rem);
    color: var(--hm-neutral-500, #64748b);
    flex-shrink: 0;
}

.hm-review-card__value {
    font-size: var(--text-sm, 0.875rem);
    color: var(--hm-neutral-900, #0f172a);
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.hm-review-card__price {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-weight: 700;
    font-size: var(--text-lg, 1.125rem);
    color: var(--hm-success-700, #15803d);
}

.hm-review-notice {
    display: flex;
    gap: var(--spacing-2, 0.5rem);
    align-items: flex-start;
    margin-top: var(--spacing-4, 1rem);
    padding: var(--spacing-3, 0.75rem);
    background: var(--hm-neutral-50, #f8fafc);
    border-radius: var(--radius-md, 8px);
    font-size: var(--text-xs, 0.75rem);
    color: var(--hm-neutral-500, #64748b);
}

.hm-review-notice i {
    font-size: 1.2rem;
    flex-shrink: 0;
    color: var(--hm-neutral-400, #94a3b8);
}

.hm-review-notice p { margin: 0; }

div.hm-review-notice p a {
    display: inline;
    padding: 0;
    color: var(--hm-primary-600, #b45309);
    text-decoration: underline;
}

/* ==========================================================================
   FORM NAVIGATION
   ========================================================================== */

.hm-post-form__nav {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-3, 0.75rem);
    margin-top: var(--spacing-6, 1.5rem);
    padding-top: var(--spacing-4, 1rem);
    border-top: 1px solid var(--hm-neutral-200, #e2e8f0);
}

/* Ensure [hidden] works on buttons (overrides .hm-btn display: inline-flex). */
.hm-post-form__nav > [hidden] {
    display: none;
}

/* ==========================================================================
   SUCCESS SCREEN
   ========================================================================== */

.hm-post-form__success {
    text-align: center;
    padding: var(--spacing-12, 3rem) var(--spacing-4, 1rem);
    animation: hmFormFadeIn 0.5s ease;
}

.hm-post-form__success-icon {
    margin-bottom: var(--spacing-4, 1rem);
}

.hm-post-form__success-title {
    font-family: var(--font-heading, 'DM Serif Display', serif);
    font-size: var(--text-2xl, 1.5rem);
    margin: 0 0 var(--spacing-2, 0.5rem);
}

.hm-post-form__success-message {
    color: var(--hm-neutral-500, #64748b);
    margin: 0 0 var(--spacing-6, 1.5rem);
}

.hm-post-form__success-actions {
    display: flex;
    gap: var(--spacing-3, 0.75rem);
    justify-content: center;
    flex-wrap: wrap;
}

/* ==========================================================================
   SHARED BUTTON REFINEMENTS
   ========================================================================== */

.hm-btn--lg {
    padding: 14px 28px;
    font-size: var(--text-lg, 1.125rem);
}

/* end classifieds-form styles */
