html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ============================================
   HOME PAGE STYLES - GULF MARKET GLOBAL
   ============================================ */

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 80px 0;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,112C672,96,768,96,864,112C960,128,1056,160,1152,160C1248,160,1344,128,1392,112L1440,96L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') bottom center no-repeat;
    background-size: cover;
    opacity: 0.3;
}

.hero-section h1 {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

/* Search Box */
.search-box {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.search-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
}

.search-box .form-control,
.search-box .form-select {
    border: 2px solid #e0e0e0;
    padding: 12px 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-box .form-control:focus,
.search-box .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Form Floating Enhancement - Fix Placeholder Overlap */
.search-box .form-floating > .form-control::placeholder,
.search-box .form-floating > .form-select::placeholder {
    color: transparent;
    opacity: 0;
}

.search-box .form-floating > .form-control:focus::placeholder,
.search-box .form-floating > .form-select:focus::placeholder {
    color: transparent;
    opacity: 0;
}

.search-box .form-floating > label {
    padding-left: 16px;
    padding-right: 16px;
    color: #6c757d;
    transition: all 0.2s ease-in-out;
}

.search-box .form-floating > .form-control:focus ~ label,
.search-box .form-floating > .form-control:not(:placeholder-shown) ~ label,
.search-box .form-floating > .form-select:focus ~ label,
.search-box .form-floating > .form-select:not([value=""]) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

/* RTL Support for Form Floating */
[dir="rtl"] .search-box .form-floating > label {
    text-align: right;
    right: 0;
    left: auto;
}

[dir="rtl"] .search-box .form-floating > .form-control:focus ~ label,
[dir="rtl"] .search-box .form-floating > .form-control:not(:placeholder-shown) ~ label {
    transform: scale(0.85) translateY(-0.5rem) translateX(-0.15rem);
}

[dir="rtl"] .search-box .form-control,
[dir="rtl"] .search-box .form-select {
    text-align: right;
    direction: rtl;
}

/* Search Suggestions */
#searchSuggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    margin-top: 2px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

[dir="rtl"] #searchSuggestions {
    text-align: right;
    direction: rtl;
}

#searchSuggestions .dropdown-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#searchSuggestions .dropdown-item:hover {
    background-color: #f8f9fa;
}

.popular-search-tag {
    padding: 6px 12px;
    font-size: 0.875rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    margin-top: 5px;
}

.popular-search-tag:hover {
    background-color: #667eea !important;
    color: white !important;
    transform: translateY(-2px);
}

/* Category Cards */
.category-card-link {
    display: block;
    transition: transform 0.3s ease;
}

.category-card-link:hover {
    transform: translateY(-5px);
}

.category-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: white;
}

.category-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

.category-card i {
    transition: transform 0.3s ease, color 0.3s ease;
}

.category-card:hover i {
    transform: scale(1.1);
    color: #764ba2 !important;
}

.category-card h5 {
    margin-bottom: 8px;
    color: #2d3748;
}

.category-card small {
    font-size: 0.875rem;
}

/* Ad Cards */
.ad-card-link {
    display: block;
    transition: transform 0.3s ease;
}

.ad-card-link:hover {
    transform: translateY(-5px);
}

.ad-card {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
}

.ad-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.15);
}

.ad-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ad-card:hover .ad-card-image {
    transform: scale(1.05);
}

.ad-card .card-body {
    padding: 15px;
}

.ad-card .card-title {
    color: #2d3748;
    font-size: 1rem;
    margin-bottom: 10px;
    transition: color 0.2s ease;
}

.ad-card:hover .card-title {
    color: #667eea;
}

/* Badges */
.badge-featured {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

.badge-urgent {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(250, 112, 154, 0.3);
}

/* View All Buttons */
.view-all-btn {
    border: 2px solid #667eea;
    color: #667eea;
    font-weight: 600;
    padding: 10px 25px;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.view-all-btn:hover {
    background: #667eea;
    color: white;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* RTL Specific Adjustments */
[dir="rtl"] .view-all-btn:hover {
    transform: translateX(-5px);
}

[dir="rtl"] .popular-search-tag {
    margin-right: 0;
    margin-left: 0.25rem;
}

/* Feature Cards */
.feature-card {
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
}

.feature-card i {
    transition: transform 0.3s ease;
}

.feature-card:hover i {
    transform: scale(1.2) rotate(5deg);
}

/* Call to Action Section */
.cta-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.cta-section .btn-primary {
    background: white;
    color: #667eea;
    border: none;
    font-weight: 600;
    padding: 12px 30px;
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.cta-section .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    background: #f8f9fa;
}

/* Hover Lift Effect */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.alert-info {
    border-left: 4px solid #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

[dir="rtl"] .alert-info {
    border-left: none;
    border-right: 4px solid #667eea;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding: 50px 0;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .search-box .form-control,
    .search-box .form-select {
        font-size: 0.875rem;
    }

    /* Enhanced mobile form-floating */
    .search-box .form-floating > label {
        font-size: 0.875rem;
        padding-left: 12px;
        padding-right: 12px;
    }

    .search-box .form-floating > .form-control,
    .search-box .form-floating > .form-select {
        padding: 10px 12px;
        height: auto;
        min-height: 3.5rem;
    }

    /* Ensure labels remain readable on mobile */
    .search-box .form-floating > .form-control:focus ~ label,
    .search-box .form-floating > .form-control:not(:placeholder-shown) ~ label,
    .search-box .form-floating > .form-select:focus ~ label,
    .search-box .form-floating > .form-select:not([value=""]) ~ label {
        font-size: 0.75rem;
    }

    /* Mobile RTL adjustments */
    [dir="rtl"] .search-box .form-floating > label {
        padding-right: 12px;
        padding-left: 12px;
    }

    /* Stack search form on mobile */
    .search-box .row.g-3 {
        gap: 0.75rem !important;
    }

    .category-card {
        padding: 15px 10px;
    }

    .category-card i {
        font-size: 2rem !important;
    }

    .ad-card-image {
        height: 150px;
    }

    /* Improve mobile search UX */
    #searchSuggestions {
        font-size: 0.875rem;
        max-height: 250px;
    }
    /* Specs card styling for details page */
    .specs-card {
        border: 1px solid #e9ecef;
        border-radius: 10px;
        padding: 1rem;
        background: #ffffff;
    }

    .specs-card .text-muted {
        font-size: 0.9rem;
    }

    /* Ensure badges and spec items respect RTL */
    [dir="rtl"] .specs-card {
        text-align: right;
        direction: rtl;
    }

    [dir="ltr"] .specs-card {
        text-align: left;
        direction: ltr;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .search-box .form-floating > label {
        font-size: 0.9rem;
    }

    .search-box .form-control,
    .search-box .form-select {
        font-size: 0.9rem;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus Styles for Accessibility */
a:focus,
button:focus,
input:focus,
select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ============================================
   ADVERTISEMENT DETAILS PAGE ENHANCEMENTS
   ============================================ */

/* Enhanced Media Gallery */
.media-gallery {
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.gallery-main {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    min-height: 400px;
    overflow: hidden;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-thumbnails {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: #fafafa;
    overflow-x: auto;
    border-top: 1px solid #e9ecef;
}

.thumbnail-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 3px solid transparent;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.thumbnail-image:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.thumbnail-image.active {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

.image-counter {
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 10;
}

.gallery-main .btn {
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 11;
    background: white;
    border: 1px solid #dee2e6;
}

.gallery-main:hover .btn {
    opacity: 0.8;
}

.gallery-main .btn:hover {
    opacity: 1 !important;
    background: white !important;
}

/* Seller Stats Card */
.seller-card {
    border-radius: 12px;
    border: 1px solid #e9ecef;
    background: white;
}

.seller-header {
    display: flex;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.seller-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #f0f0f0;
    margin-right: 16px;
}

[dir="rtl"] .seller-avatar {
    margin-left: 16px;
    margin-right: 0;
}

.seller-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 16px 0;
}

.stat-item {
    text-align: center;
    padding: 12px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: #999;
    font-weight: 500;
}

.seller-details .detail-item {
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.seller-details .detail-item:last-child {
    border-bottom: none;
}

/* Activity Metrics */
.activity-metrics {
    border-radius: 12px;
    border: 1px solid #e9ecef;
    background: white;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 16px;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 8px;
}

.metric-item {
    text-align: center;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.metric-value i {
    margin-right: 4px;
}

[dir="rtl"] .metric-value i {
    margin-right: 0;
    margin-left: 4px;
}

.metric-label {
    font-size: 0.85rem;
    color: #999;
    font-weight: 500;
}

.status-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 0;
}

.status-flags .badge {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 20px;
}

/* Location Card */
.location-card {
    border-radius: 12px;
    border: 1px solid #e9ecef;
    background: white;
}

.location-details .location-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.location-details .location-item:last-child {
    border-bottom: none;
}

.location-item i {
    font-size: 1.25rem;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.map-container {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 16px;
}

.full-location {
    background: #f9f9f9;
    padding: 16px;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.full-location i {
    font-size: 1.5rem;
    color: #667eea;
    flex-shrink: 0;
}

.full-location .location-text {
    font-size: 1rem;
    color: #333;
    font-weight: 500;
    line-height: 1.6;
}

/* Related Ads Section */
.related-ads-section {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 2px solid #e9ecef;
}

.related-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #667eea;
}

.section-header h5 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header i {
    color: #667eea;
    font-size: 1.5rem;
}

.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.ad-card {
    border-radius: 8px;
    border: 1px solid #e9ecef;
    background: white;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.ad-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.ad-image-wrapper {
    position: relative;
    overflow: hidden;
    height: 200px;
    background: #e9ecef;
}

.ad-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ad-card:hover .ad-image-wrapper img {
    transform: scale(1.08);
}

.ad-card .card-body {
    padding: 12px;
}

.ad-card .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Spec Cards */
.specs-card {
    border-radius: 12px;
    border: 1px solid #e9ecef;
    background: white;
    padding: 16px;
    margin-bottom: 16px;
}

.specs-card h5 {
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.specs-card h5 i {
    color: #667eea;
}

.specs-list .d-flex {
    padding: 8px 0;
    font-size: 0.95rem;
}

.specs-list .badge {
    padding: 6px 10px;
    margin-right: 4px;
    margin-bottom: 4px;
    border-radius: 6px;
}

/* RTL Support */
[dir="rtl"] .seller-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .seller-avatar {
    margin-right: 0;
    margin-left: 16px;
}

[dir="rtl"] .location-item i {
    margin-left: 8px;
    margin-right: 0;
}

[dir="rtl"] .full-location {
    flex-direction: row-reverse;
}

[dir="rtl"] .specs-card h5 {
    flex-direction: row-reverse;
}

[dir="rtl"] .badge {
    margin-right: 0;
    margin-left: 4px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery-main {
        min-height: 350px;
    }

    .ads-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .seller-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .gallery-main {
        min-height: 300px;
    }

    .gallery-thumbnails {
        gap: 6px;
        padding: 12px;
    }

    .thumbnail-image {
        width: 70px;
        height: 70px;
    }

    .ads-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .ad-image-wrapper {
        height: 150px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 12px;
    }

    .metric-value {
        font-size: 1.1rem;
    }

    .metric-label {
        font-size: 0.75rem;
    }

    .seller-avatar {
        width: 60px;
        height: 60px;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .section-header h5 {
        font-size: 1.1rem;
    }

    .specs-card {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .gallery-main {
        min-height: 250px;
    }

    .ads-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .seller-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 12px;
    }

    .stat-item {
        padding: 8px;
    }

    .section-header {
        padding-bottom: 8px;
    }

    .section-header h5 {
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    .hero-section,
    .cta-section,
    .search-box,
    .btn {
        display: none;
    }
}
