/* Post Ad Page Styles */

.post-ad-container {
    max-width: 800px;
    margin: 80px auto 40px;
    padding: 0 20px;
}

/* Step 1: Category Selection */
.step-container {
    animation: fadeIn 0.3s ease;
}

.step-container.active {
    display: block;
}

.step-title {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 30px;
}

.category-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 520px;
    margin: 0 auto;
}

.category-card {
    background: var(--white);
    border-radius: 14px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    border: 1px solid var(--border-color);
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
}

.category-card:hover {
    background: var(--input-bg);
    border-color: var(--primary-color);
}

.category-card i {
    font-size: 20px;
    color: var(--primary-color);
    width: 28px;
    text-align: center;
    flex: 0 0 auto;
}

.category-card span {
    font-weight: 600;
    color: var(--text-color);
    font-size: 15px;
    text-align: left;
}

@media (min-width: 720px) {
    .category-grid {
        grid-template-columns: 1fr 1fr;
        max-width: 800px;
        gap: 14px;
    }
}

/* Step 2: Form Styles */
.post-ad-form {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.back-step-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.back-step-btn:hover {
    color: var(--primary-color);
}

.form-section {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.section-label {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: background 0.2s;
}

.checkbox-item:hover {
    background: var(--bg-color);
}

.checkbox-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* Preview Badges */
.preview-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 40px;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge.blue { background-color: #3b82f6; }
.badge.green { background-color: #10b981; }
.badge.purple { background-color: #8b5cf6; }
.badge.orange { background-color: #f59e0b; }
.badge.gray { background-color: #64748b; }

/* Image Upload Styles */
.image-upload-container {
    width: 100%;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.add-image-btn {
    aspect-ratio: 1;
    width: 100%;
    border: 2px dashed #ccc;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
    background: #f9f9f9;
    padding-top: 40px;
    padding-left: 8px;
}

.add-image-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #f0f7ff;
}

.add-image-btn i {
    font-size: 15px;
    margin-bottom: 0;
    line-height: 1;
}

.add-image-btn span {
    font-size: 12px;
    font-weight: 500;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ff4444;
    font-size: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Form Inputs */
.form-group {
    margin-bottom: 20px;
    flex: 1;
    min-width: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
    width: 100%;
    min-width: 0;
}

/* If a row has only one field, make it span full width */
.form-row > .form-group:only-child {
    grid-column: 1 / -1;
}

/* Avoid double spacing inside rows */
.form-row .form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: #f9f9f9;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.price-input-group {
    display: flex;
    gap: 10px;
}

.price-input-group input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.price-input-group select {
    width: auto;
    min-width: 90px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
    background-color: #eee;
    font-weight: 600;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.helper-text {
    font-size: 0.85rem;
    color: #888;
    margin-top: 10px;
}

/* Submit Button */
.form-actions {
    position: sticky;
    bottom: 20px;
    z-index: 10;
}

.submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .post-ad-container {
        margin-top: 70px;
        padding: 0 15px;
    }

    .form-section {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .image-preview-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .image-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .section-label {
        font-size: 1.1rem;
    }
}