/* Autoscoutclone - Mobile-First Responsive Stylesheet */

/* =============================================================================
   MOBILE-FIRST BASE STYLES (320px+)
   ============================================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    font-size: 16px; /* Base font size */
}

.container {
    width: 100%;
    padding: 15px;
    margin: 0 auto;
}

/* =============================================================================
   NAVIGATION - MOBILE
   ============================================================================= */

.navbar {
    background-color: #e5e4e4;
    color: #333;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* Logo */
.nav-brand {
    flex-shrink: 0;
}

.nav-brand a {
    display: block;
    line-height: 0;
}

.logo {
    height: 50px;
    width: auto;
    display: block;
}

/* Hamburger Menu Button (Mobile Only) */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger span {
    width: 30px;
    height: 3px;
    background-color: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(11px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-11px) rotate(-45deg);
}

/* Navigation Menu */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: fixed;
    top: 68px;
    right: -100%;
    width: 280px;
    height: calc(100vh - 68px);
    background-color: #ffffff;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    padding: 2rem 0;
    z-index: 1000;
    overflow-y: auto;
}

.nav-menu.active {
    right: 0;
}

.nav-menu li {
    width: 100%;
}

.nav-menu a,
.nav-menu button {
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
    padding: 1rem 2rem;
    display: block;
    width: 100%;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.nav-menu a:hover,
.nav-menu a:active,
.nav-menu button:hover {
    background-color: #f8f8f8;
    color: #ff6600;
}

.nav-menu .btn-primary {
    margin: 1rem 2rem;
    width: calc(100% - 4rem);
    text-align: center;
    border: none;
    border-bottom: none;
}

/* =============================================================================
   HERO SECTION - MOBILE
   ============================================================================= */

.hero {
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    padding: 0 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 1rem;
    margin-top: 1.5rem;
}

.search-form input {
    width: 100%;
    padding: 0.875rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #f8f8f8;
}

.autocomplete-item strong {
    color: #333;
    font-weight: 600;
}

.autocomplete-item mark {
    background-color: #fff3cd;
    color: #333;
    padding: 2px 4px;
    border-radius: 2px;
}

.autocomplete-item .count {
    color: #666;
    font-size: 0.875rem;
    background-color: #f0f0f0;
    padding: 4px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

/* =============================================================================
   BUTTONS - MOBILE
   ============================================================================= */

.btn {
    display: inline-block;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    text-align: center;
    min-height: 44px; /* Touch-friendly minimum */
    font-weight: 600;
}

.btn-primary {
    background-color: #ff6600;
    color: white;
}

.btn-primary:hover,
.btn-primary:active {
    background-color: #e55a00;
}

.btn-secondary {
    background-color: #666;
    color: white;
}

.btn-secondary:hover,
.btn-secondary:active {
    background-color: #555;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-small {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    display: inline-block;
    margin: 0.25rem;
    min-height: 36px;
}

.btn-link {
    background: none;
    color: inherit;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}

/* =============================================================================
   ALERTS - MOBILE
   ============================================================================= */

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-size: 0.9375rem;
}

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

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

/* =============================================================================
   LISTINGS GRID - MOBILE (Single Column)
   ============================================================================= */

.listings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.listing-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.listing-card:active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.listing-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.no-image {
    width: 100%;
    height: 200px;
    background-color: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95a5a6;
    font-size: 0.875rem;
}

.listing-info {
    padding: 1rem;
}

.listing-info h3 {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

.listing-info h3 a {
    color: #2c3e50;
    text-decoration: none;
}

.listing-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.listing-price {
    font-size: 1.375rem;
    font-weight: bold;
    color: #27ae60;
    margin: 0.5rem 0;
}

.listing-location {
    font-size: 0.875rem;
    color: #7f8c8d;
}

/* =============================================================================
   SEARCH LAYOUT - MOBILE (Stacked)
   ============================================================================= */

.search-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.filters {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    order: 2; /* Filters below results on mobile */
}

.filter-group {
    margin-bottom: 1.25rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    min-height: 44px; /* Touch-friendly */
}

.results-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.sort-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sort-form select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 44px;
}

/* =============================================================================
   PAGINATION - MOBILE
   ============================================================================= */

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination a {
    padding: 0.625rem 0.875rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    min-width: 44px;
    text-align: center;
}

.pagination a.active {
    background-color: #ff6600;
    color: white;
    border-color: #ff6600;
}

.pagination a:active:not(.active) {
    background-color: #ecf0f1;
}

/* =============================================================================
   LISTING DETAIL - MOBILE
   ============================================================================= */

.listing-detail {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.listing-header {
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.listing-header h1 {
    font-size: 1.5rem;
}

.listing-price-large {
    font-size: 1.75rem;
    font-weight: bold;
    color: #27ae60;
    margin-top: 0.5rem;
}

.listing-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.photo-gallery {
    margin-bottom: 1.5rem;
}

.main-photo img {
    width: 100%;
    border-radius: 8px;
}

.photo-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.photo-thumbnails img {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.3s;
}

.photo-thumbnails img:active {
    opacity: 0.7;
}

.listing-specs-detail table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.listing-specs-detail td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.listing-specs-detail td:first-child {
    font-weight: 600;
    width: 45%;
}

.listing-features {
    margin-top: 1.5rem;
}

.feature-category {
    margin-bottom: 1.25rem;
}

.feature-category h3 {
    color: #7f8c8d;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.feature-category ul {
    list-style: none;
}

.feature-category li {
    padding: 0.375rem 0;
    font-size: 0.9375rem;
}

.listing-sidebar .seller-info,
.listing-sidebar .contact-form {
    background: #f8f9fa;
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* =============================================================================
   FORMS - MOBILE
   ============================================================================= */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9375rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    min-height: 44px; /* Touch-friendly */
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group .error {
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.375rem;
    display: block;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: normal;
    min-height: 44px;
    font-size: 0.9375rem;
}

.checkbox-label input[type="checkbox"] {
    min-width: 20px;
    min-height: 20px;
}

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

/* =============================================================================
   AUTH FORMS - MOBILE
   ============================================================================= */

.auth-container {
    width: 100%;
    max-width: 100%;
    margin: 2rem auto;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.auth-form {
    margin: 1.5rem 0;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9375rem;
}

/* =============================================================================
   DASHBOARD - MOBILE
   ============================================================================= */

.dashboard-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 2rem;
    color: #ff6600;
    margin-bottom: 0.5rem;
}

.dashboard-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.dashboard-section {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* =============================================================================
   TABLES - MOBILE (Responsive)
   ============================================================================= */

.listings-table,
.leads-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.875rem;
    display: block;
    overflow-x: auto;
}

.listings-table th,
.leads-table th {
    background-color: #ecf0f1;
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.listings-table td,
.leads-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-secondary {
    background-color: #e2e3e5;
    color: #383d41;
}

/* =============================================================================
   WIZARD - MOBILE
   ============================================================================= */

.wizard {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.wizard-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.step {
    padding: 0.75rem;
    background-color: #ecf0f1;
    border-radius: 8px;
    text-align: center;
    font-size: 0.875rem;
}

.step.active {
    background-color: #ff6600;
    color: white;
    font-weight: 600;
}

.step.completed {
    background-color: #27ae60;
    color: white;
}

.wizard-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.wizard-note {
    text-align: center;
    color: #7f8c8d;
    margin-top: 1rem;
    font-size: 0.875rem;
}

/* =============================================================================
   LEADS - MOBILE
   ============================================================================= */

.lead-card {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #ff6600;
}

.lead-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.lead-date {
    color: #7f8c8d;
    font-size: 0.875rem;
}

.lead-contact p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
}

.lead-message {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
    font-size: 0.9375rem;
}

/* =============================================================================
   ERROR PAGES - MOBILE
   ============================================================================= */

.error-page {
    text-align: center;
    padding: 3rem 1.5rem;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.error-page h1 {
    font-size: 4rem;
    color: #ff6600;
    margin-bottom: 1rem;
}

.error-page h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

/* =============================================================================
   FOOTER - MOBILE
   ============================================================================= */

footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    font-size: 0.875rem;
}

/* =============================================================================
   UTILITIES
   ============================================================================= */

.text-center {
    text-align: center;
}

/* =============================================================================
   TABLET RESPONSIVE (min-width: 600px)
   ============================================================================= */

@media (min-width: 600px) {
    .container {
        padding: 20px;
        max-width: 960px;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .search-form {
        flex-direction: row;
        max-width: 600px;
        margin: 2rem auto 0;
    }

    .listings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.75rem;
    }

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

    .form-row {
        flex-direction: row;
    }

    .form-row > * {
        flex: 1;
    }

    .feature-checkboxes {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    .auth-container {
        max-width: 500px;
        padding: 2rem;
        margin: 3rem auto;
    }

    .wizard {
        padding: 1.75rem;
        max-width: 700px;
        margin: 2rem auto;
    }

    .wizard-steps {
        flex-direction: row;
        position: relative;
        gap: 1rem;
    }

    .wizard-steps::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        height: 2px;
        background-color: #ecf0f1;
        z-index: 0;
    }

    .step {
        flex: 1;
        position: relative;
        z-index: 1;
        background: white;
        border: 2px solid #ecf0f1;
        font-size: 0.9375rem;
    }

    .step.active {
        border-color: #ff6600;
    }

    .step.completed {
        border-color: #27ae60;
    }

    .wizard-actions {
        flex-direction: row;
        justify-content: space-between;
    }

    .dashboard-actions {
        flex-direction: row;
    }

    .listing-header h1 {
        font-size: 1.875rem;
    }

    .listing-price-large {
        font-size: 2rem;
    }

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

    .photo-thumbnails img {
        height: 80px;
    }
}

/* =============================================================================
   DESKTOP RESPONSIVE (min-width: 768px)
   ============================================================================= */

@media (min-width: 768px) {
    .container {
        max-width: 1200px;
    }

    /* Hide hamburger on desktop */
    .hamburger {
        display: none;
    }

    /* Desktop navigation */
    .nav-menu {
        position: static;
        flex-direction: row;
        gap: 2rem;
        width: auto;
        height: auto;
        background: transparent;
        box-shadow: none;
        padding: 0;
        align-items: center;
    }

    .nav-menu li {
        width: auto;
    }

    .nav-menu a,
    .nav-menu button {
        padding: 0.5rem 1rem;
        border-bottom: none;
    }

    .nav-menu a:hover,
    .nav-menu button:hover {
        background-color: transparent;
        color: #ff6600;
    }

    .nav-menu .btn-primary {
        margin: 0;
        width: auto;
        padding: 0.75rem 1.5rem;
    }

    .logo {
        height: 60px;
    }

    .hero {
        padding: 4rem 0;
    }

    .hero h1 {
        font-size: 3rem;
    }

    .listings-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 2rem;
    }

    .search-layout {
        display: grid;
        grid-template-columns: 250px 1fr;
        gap: 2rem;
    }

    .filters {
        order: 0;
        position: sticky;
        top: 20px;
        height: fit-content;
    }

    .results-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .sort-form {
        flex-direction: row;
        align-items: center;
    }

    .sort-form select {
        width: auto;
        min-width: 200px;
    }

    .listing-content {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
    }

    .listing-specs-detail td {
        padding: 0.75rem;
    }

    .feature-category ul {
        column-count: 2;
    }

    .dashboard-stats {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .stat-card h3 {
        font-size: 2.5rem;
    }

    .wizard {
        max-width: 800px;
    }

    .lead-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .error-page h1 {
        font-size: 6rem;
    }

    .error-page h2 {
        font-size: 2rem;
    }
}

/* =============================================================================
   LARGE DESKTOP (min-width: 1200px)
   ============================================================================= */

@media (min-width: 1200px) {
    .listings-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

    .search-layout {
        grid-template-columns: 280px 1fr;
    }
}

/* =============================================================================
   HOVER SUPPORT (Desktop with mouse)
   ============================================================================= */

@media (hover: hover) and (pointer: fine) {
    .listing-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

    .photo-thumbnails img:hover {
        opacity: 0.7;
    }

    .pagination a:hover:not(.active) {
        background-color: #ecf0f1;
    }
}
