/* ==========================================================================
   My Ads Pages
   Covers: my_ads/index, my_ads/new, my_ads/edit
   ========================================================================== */

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.my-ads-wrapper {
    padding: 40px 0;
    background: var(--bg-light);
    min-height: 50vh;
}

.my-ads-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.my-ads-container--narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.my-ads-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.my-ads-header--stacked {
    display: block;
    margin-bottom: 30px;
}

.my-ads-header h1 {
    color: var(--primary-blue);
    font-size: 1.8rem;
    margin: 0;
}

.my-ads-header--stacked h1 {
    color: var(--primary-blue);
    font-size: 1.8rem;
    margin: 0 0 10px;
}

.my-ads-header .back-link {
    color: var(--primary-orange);
    text-decoration: none;
}

.my-ads-header .back-link:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Profile Navigation (shared tab bar)
   -------------------------------------------------------------------------- */

.profile-nav {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.profile-nav a {
    color: var(--text-light);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
}

.profile-nav a:hover {
    color: var(--primary);
    background: rgba(30, 58, 95, 0.05);
}

.profile-nav a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.2);
}

/* --------------------------------------------------------------------------
   New Ad Button
   -------------------------------------------------------------------------- */

.btn-new-ad {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-new-ad:hover {
    background: var(--secondary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.2);
}

.btn-new-ad.disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Verification Warning
   -------------------------------------------------------------------------- */

.verification-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.verification-warning i {
    color: #856404;
    font-size: 1.2rem;
}

.verification-warning p {
    margin: 0;
    color: #856404;
}

/* --------------------------------------------------------------------------
   Ads List
   -------------------------------------------------------------------------- */

.ads-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* --------------------------------------------------------------------------
   Ad Card
   -------------------------------------------------------------------------- */

.ad-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 20px;
    transition: all 0.3s ease;
}

.ad-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.ad-image {
    width: 150px;
    height: 100px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.ad-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-image .no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 2rem;
}

.ad-content {
    flex: 1;
}

.ad-content h3 {
    margin: 0 0 10px;
    color: var(--primary-blue);
    font-size: 1.1rem;
}

.ad-content h3 a {
    color: inherit;
    text-decoration: none;
}

.ad-content h3 a:hover {
    color: var(--primary-orange);
}

/* --------------------------------------------------------------------------
   Ad Meta
   -------------------------------------------------------------------------- */

.ad-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.ad-meta .price {
    color: var(--primary-orange);
    font-weight: 700;
}

.ad-meta-secondary {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* --------------------------------------------------------------------------
   Ad Status Badges
   -------------------------------------------------------------------------- */

.ad-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.ad-status.pending {
    background: #fff3cd;
    color: #856404;
}

.ad-status.approved {
    background: #d4edda;
    color: #155724;
}

.ad-status.rejected {
    background: #f8d7da;
    color: #721c24;
}

.ad-status.expired {
    background: #e2e3e5;
    color: #383d41;
}

/* --------------------------------------------------------------------------
   Ad Actions
   -------------------------------------------------------------------------- */

.ad-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.ad-actions a,
.ad-actions button {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.ad-actions .btn-edit {
    background: var(--primary);
    color: white;
}

.ad-actions .btn-edit:hover {
    background: var(--secondary);
    transform: translateX(2px);
}

.ad-actions .btn-delete {
    background: #dc3545;
    color: white;
}

.ad-actions .btn-delete:hover {
    background: #c82333;
    transform: translateX(2px);
}

/* --------------------------------------------------------------------------
   No Ads Empty State
   -------------------------------------------------------------------------- */

.no-ads {
    background: white;
    border-radius: 8px;
    padding: 60px 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.no-ads i {
    font-size: 3rem;
    color: #ccc;
    margin-bottom: 15px;
}

.no-ads p {
    color: var(--text-light);
    margin-bottom: 20px;
}

/* --------------------------------------------------------------------------
   My Ad Card (grid card with actions)
   -------------------------------------------------------------------------- */

.my-ad-card {
    position: relative;
}

.my-ad-card .ad-card-image {
    position: relative;
}

/* Status badge on card image */
.my-ad-status {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.my-ad-status--draft {
    background: #e2e3e5;
    color: #383d41;
}

.my-ad-status--pending {
    background: #fff3cd;
    color: #856404;
}

.my-ad-status--active {
    background: #d4edda;
    color: #155724;
}

.my-ad-status--rejected {
    background: #f8d7da;
    color: #721c24;
}

.my-ad-status--expired,
.my-ad-status--sold,
.my-ad-status--rented,
.my-ad-status--archived {
    background: #e2e3e5;
    color: #383d41;
}

/* Date in card footer */
.my-ad-date {
    font-size: 0.8rem;
    color: var(--text-light);
}

.my-ad-date i {
    margin-right: 3px;
}

/* Card actions bar */
.my-ad-card-actions {
    display: flex;
    border-top: 1px solid var(--border-color);
}

.my-ad-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-light);
}

.my-ad-action-btn + .my-ad-action-btn {
    border-left: 1px solid var(--border-color);
}

.my-ad-action-btn:hover {
    background: var(--bg-light);
}

.my-ad-action-edit:hover {
    color: var(--primary-blue);
}

.my-ad-action-images:hover {
    color: var(--primary-orange);
}

.my-ad-action-delete:hover {
    color: #dc3545;
    background: #fef2f2;
}

/* Flash messages */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* --------------------------------------------------------------------------
   Ad Form Card (new / edit)
   -------------------------------------------------------------------------- */

.ad-form-card {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ad-form-card h2 {
    color: var(--primary-blue);
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-orange);
}

.ad-form-card .form-control {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid #ddd;
}

.ad-form-card .form-control:focus {
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 0.2rem rgba(244, 121, 32, 0.15);
}

.ad-form-card .form-label {
    font-weight: 500;
    color: #333;
}

.ad-form-card .btn-primary {
    background: var(--primary-orange);
    border: none;
    padding: 12px 30px;
    font-weight: 600;
}

.ad-form-card .btn-primary:hover {
    background: #e06810;
}

.ad-form-card .btn-secondary {
    background: #6c757d;
    border: none;
    padding: 12px 30px;
}

.form-section {
    margin-bottom: 30px;
}

.form-help {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* --------------------------------------------------------------------------
   Edit Notice (edit page only)
   -------------------------------------------------------------------------- */

.edit-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.edit-notice p {
    margin: 0;
    color: #856404;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
    .profile-nav {
        flex-direction: column;
        gap: 10px;
    }

    .profile-nav a {
        text-align: center;
    }

    .my-ads-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .ad-card {
        flex-direction: column;
    }

    .ad-image {
        width: 100%;
        height: 150px;
    }

    .ad-actions {
        flex-direction: row;
        justify-content: flex-start;
    }

    .my-ads-container {
        padding: 0 15px;
    }

    .my-ad-action-btn {
        font-size: 0.75rem;
        padding: 8px 4px;
    }
}

/* ==========================================================================
   Ad Create / Edit Layout (Two-column with sidebar)
   ========================================================================== */

.ad-create-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.ad-create-main {
    min-width: 0;
}

.ad-create-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --------------------------------------------------------------------------
   Sidebar Cards
   -------------------------------------------------------------------------- */

.sidebar-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sidebar-card h3 {
    font-size: 1rem;
    margin: 0 0 15px;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-card h3 i {
    color: var(--primary-orange);
}

.sidebar-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-card ul li {
    padding: 6px 0;
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.sidebar-card ul li i {
    color: var(--primary-orange);
    margin-top: 3px;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Step Indicator
   -------------------------------------------------------------------------- */

.step-indicator {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.step-item {
    flex: 1;
    text-align: center;
    padding: 15px;
    position: relative;
    font-size: 0.95rem;
    color: var(--text-light);
    border-bottom: 3px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.step-item.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-orange);
    font-weight: 600;
    background: rgba(244, 121, 32, 0.03);
}

.step-item.completed {
    color: var(--primary-orange);
    border-bottom-color: var(--primary-orange);
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.step-item.active .step-number {
    background: var(--primary-orange);
    color: white;
}

.step-item.completed .step-number {
    background: var(--primary-orange);
    color: white;
}

.step-item.upcoming .step-number {
    background: #e9ecef;
    color: var(--text-light);
}

/* --------------------------------------------------------------------------
   Form Row Layout (replaces Bootstrap .row/.col-md-6)
   -------------------------------------------------------------------------- */

.ad-form-card .form-group {
    margin-bottom: 20px;
}

.ad-form-card .form-group label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.ad-form-card .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.ad-form-card .form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.ad-form-card .input-with-suffix {
    display: flex;
    align-items: stretch;
}

.ad-form-card .input-with-suffix .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.ad-form-card .input-suffix {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-left: none;
    border-radius: 0 0.5rem 0.5rem 0;
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Checkbox & Feature Grid
   -------------------------------------------------------------------------- */

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.checkbox-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-orange);
    cursor: pointer;
}

.checkbox-inline label {
    margin-bottom: 0 !important;
    font-weight: 400 !important;
    cursor: pointer;
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.feature-category h4 {
    font-size: 0.95rem;
    margin: 0 0 10px;
    color: var(--primary-blue);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.feature-checkboxes {
    display: flex;
    flex-direction: column;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 0;
    font-size: 0.9rem;
    color: #444;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-orange);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label:hover {
    color: var(--primary-blue);
}

/* --------------------------------------------------------------------------
   Image Upload - Drop Zone
   -------------------------------------------------------------------------- */

.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.upload-dropzone:hover {
    border-color: var(--primary-orange);
    background: rgba(244, 121, 32, 0.02);
}

.upload-dropzone.dragover {
    border-color: var(--primary-orange);
    background: rgba(244, 121, 32, 0.05);
    transform: scale(1.01);
}

.upload-dropzone-icon {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 15px;
}

.upload-dropzone.dragover .upload-dropzone-icon {
    color: var(--primary-orange);
}

.upload-dropzone-text {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.upload-dropzone-text span {
    color: var(--primary-orange);
    font-weight: 600;
}

.upload-dropzone-hint {
    font-size: 0.85rem;
    color: #999;
    margin-top: 10px;
}

/* --------------------------------------------------------------------------
   Image Thumbnails Grid
   -------------------------------------------------------------------------- */

.image-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 15px;
}

.image-grid-header h3 {
    font-size: 1rem;
    color: var(--primary-blue);
    margin: 0;
}

.image-count {
    font-size: 0.9rem;
    color: var(--text-light);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.image-thumb {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: #f0f0f0;
    cursor: grab;
}

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

.image-thumb-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-thumb:hover .image-thumb-actions {
    opacity: 1;
}

.image-thumb-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.image-thumb-btn:hover {
    transform: scale(1.1);
}

.image-thumb-main {
    background: rgba(244, 121, 32, 0.9);
    color: white;
}

.image-thumb-delete {
    background: rgba(220, 53, 69, 0.9);
    color: white;
}

.image-thumb.is-main {
    border: 3px solid var(--primary-orange);
}

.image-thumb-badge {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: var(--primary-orange);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* Upload progress */
.image-thumb-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #eee;
}

.image-thumb-progress-bar {
    height: 100%;
    background: var(--primary-orange);
    transition: width 0.3s ease;
    border-radius: 0 2px 2px 0;
}

/* Drag reorder states */
.image-thumb.dragging {
    opacity: 0.5;
}

.image-thumb.drag-over {
    outline: 2px dashed var(--primary-orange);
    outline-offset: -2px;
}

/* Upload error state */
.image-thumb.upload-error {
    border: 2px solid #dc3545;
}

.image-thumb-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    font-size: 0.75rem;
    padding: 5px;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Image page actions
   -------------------------------------------------------------------------- */

.image-page-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.image-page-actions .btn {
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.image-page-actions .btn-back {
    background: #e9ecef;
    color: #333;
}

.image-page-actions .btn-back:hover {
    background: #dee2e6;
}

.image-page-actions .btn-publish {
    background: var(--primary-orange);
    color: white;
}

.image-page-actions .btn-publish:hover {
    background: #e06810;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 121, 32, 0.3);
}

/* Reorder hint */
.image-reorder-hint {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --------------------------------------------------------------------------
   Ad Create/Edit Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 992px) {
    .ad-create-layout {
        grid-template-columns: 1fr;
    }

    .ad-create-sidebar {
        order: -1;
    }

    .step-indicator {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .ad-form-card .form-row,
    .ad-form-card .form-row-3 {
        grid-template-columns: 1fr;
    }

    .feature-grid {
        grid-template-columns: 1fr;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .step-item {
        padding: 10px 8px;
        font-size: 0.8rem;
        flex-direction: column;
        gap: 5px;
    }

    .step-number {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .upload-dropzone {
        padding: 25px 15px;
    }

    .upload-dropzone-icon {
        font-size: 2rem;
    }

    .image-page-actions {
        flex-direction: column;
        gap: 10px;
    }

    .image-page-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .ad-create-layout {
        padding: 0 15px;
    }
}
