/**
 * Minhas Ofertas - Redesign Completo
 * Mobile-First, Clean UI/UX
 */

/* ===== Grid de Cards ===== */
#myPostsGrid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 24px;
}

/* ===== Card do Post ===== */
.my-post-card {
    background: #FFFFFF;
    border: 1px solid rgba(255, 107, 53, 0.15);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.my-post-card:hover {
    border-color: rgba(255, 107, 53, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ===== Imagem do Card ===== */
.my-post-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    background-color: #F9FAFB;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 16px;
}

.my-post-thumb::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.8) 0%,
        rgba(0, 0, 0, 0.4) 50%,
        transparent 100%
    );
}

.my-post-price {
    position: relative;
    z-index: 1;
    font-size: 24px;
    font-weight: 700;
    color: #FEC400;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* ===== Fallback para imagem ===== */
.my-post-thumb:not([style*="background-image"])::after {
    content: '\f291'; /* fa-shopping-bag */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: rgba(0, 0, 0, 0.08);
    z-index: 0;
}

/* ===== Corpo do Card ===== */
.my-post-body {
    padding: 16px;
}

.my-post-top {
    margin-bottom: 12px;
}

.my-post-top h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1A1A1A;
    margin: 0 0 6px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-post-top p.muted {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.6);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-post-date {
    display: block;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
    margin-top: 8px;
}

/* ===== Métricas ===== */
.my-post-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.my-post-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.7);
}

.my-post-meta span i {
    font-size: 14px;
    color: #FEC400;
}

/* ===== Ações do Card ===== */
.my-post-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.my-post-actions .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.my-post-actions .edit-post {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.3);
    color: #FEC400;
}

.my-post-actions .edit-post:hover {
    background: rgba(255, 107, 53, 0.2);
    border-color: rgba(255, 107, 53, 0.5);
}

.my-post-actions .btn-icon-delete {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.3s ease;
}

.my-post-actions .btn-icon-delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
}

.my-post-actions .btn-icon-delete i {
    font-size: 16px;
}

/* ===== Editor de Post ===== */
#myPostEditor {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

#myPostEditor.show {
    display: flex;
}

.form-card {
    background: #FFFFFF;
    border: 1px solid rgba(255, 107, 53, 0.2);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 24px 24px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.form-header .eyebrow {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(0, 0, 0, 0.6);
    margin: 0 0 6px 0;
}

.form-header h4 {
    font-size: 18px;
    font-weight: 700;
    color: #FEC400;
    margin: 0;
    line-height: 1.3;
}

.form-header .btn-ghost {
    background: transparent;
    border: none;
    color: rgba(0, 0, 0, 0.6);
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-header .btn-ghost:hover {
    color: #1A1A1A;
    transform: rotate(90deg);
}

/* ===== Form ===== */
#editPostForm {
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1A1A1A;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    color: #1A1A1A;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    background: #FFFFFF;
    border-color: rgba(255, 107, 53, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-group input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

/* Prefixo $ no campo de preço */
.form-group input[type="number"] {
    padding-left: 32px;
}

.form-group:has(input[type="number"]) {
    position: relative;
}

.form-group:has(input[type="number"])::before {
    content: '$';
    position: absolute;
    left: 16px;
    top: 38px;
    font-size: 16px;
    font-weight: 600;
    color: #FEC400;
    pointer-events: none;
}

/* ===== Ações do Form ===== */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.form-actions .btn {
    flex: 1;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-actions .btn-secondary {
    background: var(--color-surface);
    border: 1px solid var(--border-color);
    color: var(--color-dark);
}

.form-actions .btn-secondary:hover {
    background: #FFFFFF;
    border-color: var(--border-color);
}

.form-actions .btn-primary {
    background: linear-gradient(90deg, #FEC400 0%, #FF6B35 100%);
    border: none;
    color: #FFFFFF;
    font-weight: 700;
}

.form-actions .btn-primary:hover {
    background: linear-gradient(135deg, #FF6B35 0%, #E63946 50%, #FEC400 100%);
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.4);
}

/* ===== Responsive: Tablet ===== */
@media (min-width: 768px) {
    #myPostsGrid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .my-post-actions {
        gap: 16px;
    }
}

/* ===== Responsive: Desktop ===== */
@media (min-width: 1024px) {
    #myPostsGrid {
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
    }

    .my-post-card:hover {
        transform: translateY(-4px);
    }
}

/* ===== Estados Vazios ===== */
#myPostsGrid p.muted {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: rgba(0, 0, 0, 0.6);
}
