/* Reset and Base Styles */
* {
    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;
}

#container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: linear-gradient(135deg, #ff6600 0%, #ff8833 100%);
    color: white;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#header h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

#header h1 a {
    color: white;
    text-decoration: none;
}

.tagline {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Navigation */
nav {
    background-color: #333;
    padding: 0;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

nav li {
    flex: 1;
    min-width: 100px;
}

nav a {
    display: block;
    padding: 1rem;
    color: white;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s;
}

nav a:hover {
    background-color: #555;
}

/* Main Content */
main {
    flex: 1;
    padding: 2rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

.alert-error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.btn:hover {
    background-color: #0056b3;
}

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

.btn-primary:hover {
    background-color: #cc5200;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.2rem;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
}

.btn-delete:hover {
    background-color: #c82333;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group input[type="text"],
.form-group input[type="email"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #ff6600;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.875rem;
}

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

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #eee;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    margin-bottom: 1rem;
    color: #ff6600;
}

.checkbox-label {
    display: inline-block;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.checkbox-label input {
    margin-right: 0.25rem;
}

.items-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.date-inputs {
    display: flex;
    gap: 0.5rem;
}

.date-inputs select {
    flex: 1;
}

.form-actions {
    margin-top: 2rem;
    text-align: center;
}

/* Stats Grid */
.home-stats {
    margin-bottom: 3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-box {
    background: linear-gradient(135deg, #ff6600 0%, #ff8833 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-box h3 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stat-box p {
    font-size: 1rem;
    opacity: 0.9;
}

/* Search Section */
.search-section {
    margin-bottom: 3rem;
    padding: 2rem;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.search-form {
    max-width: 800px;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.sale-card {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.sale-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.sale-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.sale-header h4 {
    margin: 0;
    font-size: 1.2rem;
}

.sale-header a {
    color: #ff6600;
    text-decoration: none;
}

.sale-header a:hover {
    text-decoration: underline;
}

.zip {
    background-color: #333;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.sale-dates {
    margin-bottom: 1rem;
    color: #666;
}

.sale-address {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: #555;
}

.sale-items {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #f9f9f9;
    border-radius: 4px;
    font-size: 0.9rem;
}

.sale-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.sale-photos img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.more-photos {
    grid-column: span 3;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

.sale-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Detail Page */
.sale-detail {
    max-width: 800px;
    margin: 0 auto;
}

.sale-detail .sale-header {
    margin-bottom: 2rem;
}

.sale-detail h2 {
    font-size: 2rem;
    color: #ff6600;
    margin-bottom: 0.5rem;
}

.info-section {
    margin-bottom: 2rem;
}

.info-section h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.dates {
    font-size: 1.1rem;
}

.address {
    font-size: 1rem;
    line-height: 1.8;
}

.items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.item-tag {
    background-color: #ff6600;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.photos-section {
    margin-bottom: 2rem;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.photos-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.photos-grid img:hover {
    transform: scale(1.05);
}

.sale-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Popular Section */
.popular-section {
    margin-bottom: 3rem;
}

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

.city-item a {
    display: block;
    padding: 0.75rem;
    background-color: #f9f9f9;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s;
}

.city-item a:hover {
    background-color: #ff6600;
    color: white;
}

.city-item .count {
    color: #666;
    font-size: 0.9rem;
}

.city-item a:hover .count {
    color: white;
}

/* CTA Section */
.cta-section {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, #ff6600 0%, #ff8833 100%);
    color: white;
    border-radius: 8px;
}

.cta-section h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-section p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* Photo Upload */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.photo-item {
    position: relative;
}

.photo-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
}

.photo-item .btn-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.no-results p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* Loading Indicator */
.htmx-indicator {
    display: none;
    text-align: center;
    padding: 1rem;
    color: #666;
}

.htmx-request .htmx-indicator {
    display: block;
}

/* PWA Install Prompt */
#install-prompt {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    display: flex;
    gap: 1rem;
    align-items: center;
    z-index: 1000;
}

#install-button {
    background-color: #ff6600;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

#install-button:hover {
    background-color: #cc5200;
}

#dismiss-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
}

/* Footer */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: auto;
}

footer p {
    margin: 0.5rem 0;
}

footer a {
    color: #ff6600;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
    
    #header h1 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-row .form-group {
        min-width: 100%;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .sale-actions {
        flex-direction: column;
    }
    
    .sale-actions .btn {
        width: 100%;
    }
}

.states-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.state-link {
    display: inline-block;
    padding: 6px 14px;
    background: #f0f0f0;
    border-radius: 20px;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
}
.state-link:hover {
    background: #ff6600;
    color: #fff;
}