.publish-page {
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.publish-status {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #141414;
    border: 1px solid #222;
    border-radius: 8px;
    color: #aaa;
}

/* Hide the status box when it has no content */
.publish-status:empty {
    display: none;
}

.publish-payments {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.payment-card {
    background-color: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.payment-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: #e8c97a;
}

.payment-price span {
    font-size: 1rem;
    font-weight: 400;
    color: #aaa;
}

.payment-card .cta-button {
    margin-top: auto;
    text-align: center;
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
}

#publish-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 2rem;
}

/* Main content wraps the fields column and the image preview. Single column —
   the form is centered at max-width:600px, which reads well on PC and mobile. */
.publish-main-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.publish-form-fields {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Each labelled field stacks its label above its control. */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Two fields side-by-side on PC (e.g. Condición + Precio); stacks on mobile. */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-row .form-group {
    min-width: 0; /* lets grid children shrink instead of overflowing */
}

/* Three fields in a row (e.g. área / habitaciones / baños). */
.form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

/* A row whose second field is hidden (e.g. category with no subcategory) drops
   to a single full-width column instead of leaving an empty half. */
.form-row.row-collapsed {
    grid-template-columns: 1fr;
}

/* Subtle "(opcional)" qualifier on field labels */
.field-optional {
    color: #888;
    font-weight: 400;
    font-size: 0.85em;
}
/* .over-limit-banner lives in styles.css (global) so the dashboard can use it too. */

#publish-form label {
    font-weight: bold;
}

#publish-form input, #publish-form textarea, #publish-form select {
    width: 100%;
    box-sizing: border-box;
    padding: 0.8rem;
    border-radius: 5px;
    border: 1px solid #e8c97a;
    background-color: #1a1a1a;
    color: #fff;
    font-size: 1rem;
    /* 16px font-size on inputs prevents iOS Safari from auto-zooming on focus */
    font-family: 'Inter', sans-serif;
}

#publish-form textarea {
    resize: vertical;
    min-height: 120px;
}

/* File input: keep it inside the card on small screens */
#publish-form input[type="file"] {
    padding: 0.6rem;
    font-size: 0.9rem;
}

#publish-form small {
    color: #aaa;
}

#publish-form small a {
    color: #e8c97a;
}

#submit-button {
    margin-top: 1rem;
    padding: 0.9rem 2rem;
    background-color: #e8c97a;
    color: #0d0d0d;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(232, 201, 122, 0.3);
}

#submit-button:disabled {
    background-color: #555;
    color: #aaa;
    cursor: not-allowed;
}

#publish-plan-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

#publish-plan-badge {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    background: rgba(232, 201, 122, 0.1);
    border: 1px solid rgba(232, 201, 122, 0.3);
    color: #e8c97a;
}

#publish-plan-badge.badge-pro {
    background: rgba(100, 200, 130, 0.1);
    border-color: rgba(100, 200, 130, 0.4);
    color: #64c882;
}

#publish-upgrade-hint {
    font-size: 0.85rem;
    color: #e8c97a;
    text-decoration: none;
    opacity: 0.85;
}

#publish-upgrade-hint:hover { text-decoration: underline; opacity: 1; }

/* Description character counter */
.description-counter {
  font-size: 0.8rem;
  color: #888;
  text-align: right;
  margin-top: 4px;
}

.description-counter.valid {
  color: #28a745;
  font-weight: bold;
}

/* ─── Image preview thumbnails ───────────────────────────────────────────── */
.publish-image-preview:empty,
#image-preview-container:empty {
    display: none;
}

#image-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.6rem;
}

.preview-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #333;
    background-color: #141414;
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ─── Per-image upload status (compress + background upload feedback) ───────── */
/* Dim the image while it uploads; clear once done. */
.preview-thumb.is-uploading img { opacity: 0.5; }
.preview-thumb.is-error img     { opacity: 0.4; }

/* Spinner shown only while uploading */
.preview-thumb .thumb-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #e8c97a;
    border-radius: 50%;
    animation: thumb-spin 0.7s linear infinite;
    display: none;
}
.preview-thumb.is-uploading .thumb-spinner { display: block; }

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

/* Status badge (✓ done / ⚠ error) in the corner */
.preview-thumb .thumb-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    color: #0d0d0d;
    font-weight: 700;
    display: none;
}
.preview-thumb.is-done  .thumb-badge { display: block; background: #2ecc71; }
.preview-thumb.is-error .thumb-badge { display: block; background: #e8c97a; color: #0d0d0d; }

/* Remove ("×") button — top-left so it never overlaps the status badge. */
.preview-thumb .thumb-remove {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s;
    z-index: 2;
}
.preview-thumb .thumb-remove:hover { background: #e74c3c; }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .publish-page {
        padding: 1.25rem 1rem;
    }

    /* Stack the Condición + Precio pair on narrow screens */
    .form-row {
        grid-template-columns: 1fr;
    }

    .publish-payments {
        grid-template-columns: 1fr;
    }

    #submit-button {
        width: 100%;
    }

    #image-preview-container {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* ─── "Destacá tu anuncio" promo (shown inside the publish form) ─────────────── */
.boost-promo {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    margin: 1.5rem 0 0.5rem;
    padding: 1rem 1.1rem;
    border: 1px solid #6b5a2a;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(232,201,122,0.07), rgba(232,201,122,0.02));
}
.boost-promo-star { font-size: 1.6rem; line-height: 1; }
.boost-promo-text { flex: 1; }
.boost-promo-text strong { color: #e8c97a; }
.boost-promo-text p { margin: 0.35rem 0 0.6rem; color: #cfcfcf; font-size: 0.92rem; }
.boost-promo-text a { color: #e8c97a; }
.boost-promo-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.boost-promo-list li {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 84px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #6b5a2a;
    border-radius: 8px;
    background: #1a1a1a;
}
.boost-promo-list li span:first-child { color: #fff; font-size: 0.85rem; }
.boost-promo-list li span:last-child { color: #e8c97a; font-weight: 700; }
