/* assets/css/style.css - Tactical Gray Military Theme with Compact Mobile Header */

/* Color Variables - Tactical Gray Scheme */
:root {
    --primary-color: #4A5D23; /* Army green */
    --primary-dark: #3C4A1C; /* Dark olive */
    --secondary-color: #708090; /* Slate gray */
    --accent-color: #D2B48C; /* Tan */
    --success-color: #6B8E23; /* Olive drab */
    --danger-color: #A0522D; /* Sienna */
    --warning-color: #B8860B; /* Dark goldenrod */
    --background: #F8F8FF; /* Ghost white */
    --surface: #F5F5F5; /* White smoke */
    --text-primary: #2F2F2F; /* Dark gray */
    --text-secondary: #696969; /* Dim gray */
    --border-color: #C0C0C0; /* Silver */
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* COMPACT HEADER DESIGN */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(74, 93, 35, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    min-height: 60px;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.025em;
}

.logo a:hover {
    color: var(--primary-dark);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    justify-content: center;
    margin: 0 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
    background: rgba(74, 93, 35, 0.1);
}

/* Active state for current page */
.nav-link.active {
    color: var(--primary-color);
    background: rgba(74, 93, 35, 0.15);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    box-shadow: 0 1px 3px rgba(74, 93, 35, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(74, 93, 35, 0.3);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
}

.btn-text:hover {
    color: var(--text-primary);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #8B4513;
}

/* Hero section - Military gradient */
.hero {
    text-align: center;
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    margin-bottom: 2rem;
    border-radius: 12px;
}

.hero h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Filters - Horizontal Layout */
.filters {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(74, 93, 35, 0.05);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.filter-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
    min-width: 0; /* Allows flex items to shrink */
}

.filter-form input,
.filter-form select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--surface);
    flex: 1;
    min-width: 120px; /* Reduced minimum width */
}

.filter-form input:focus,
.filter-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 93, 35, 0.1);
}

/* Button group for search/clear */
.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

/* Listings grid */
.listings {
    margin-bottom: 3rem;
}

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

.listing-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(74, 93, 35, 0.05);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.listing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(74, 93, 35, 0.12);
    border-color: var(--primary-color);
}

.listing-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

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

.image-count {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(47, 47, 47, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.listing-content {
    padding: 1.25rem;
}

.listing-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listing-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--success-color);
    margin-bottom: 0.75rem;
}

.listing-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.condition {
    background: rgba(74, 93, 35, 0.1);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: capitalize;
    font-weight: 500;
}

.see-more-btn {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Item detail page */
.item-detail {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(74, 93, 35, 0.05);
    margin: 2rem 0;
    border: 1px solid var(--border-color);
}

.item-header {
    padding: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.item-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.item-price {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.item-meta {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    font-weight: 500;
    text-transform: capitalize;
    color: var(--text-primary);
}

.item-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    padding: 2rem;
}

.item-gallery {
    margin-bottom: 2rem;
}

.main-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.5rem;
}

.thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: border-color 0.2s;
}

.thumbnail.active,
.thumbnail:hover {
    border-color: var(--primary-color);
}

.item-description {
    margin-bottom: 2rem;
}

.item-description h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.item-description p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.item-sidebar {
    background: rgba(74, 93, 35, 0.05);
    padding: 1.5rem;
    border-radius: 8px;
    height: fit-content;
    border: 1px solid rgba(74, 93, 35, 0.1);
}

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

.phone-revealed {
    background: rgba(107, 142, 35, 0.1);
    border: 2px solid var(--success-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.phone-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--success-color);
    margin-bottom: 0.5rem;
}

.contact-instructions {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.unlock-prompt {
    text-align: center;
    padding: 1.5rem;
    background: rgba(184, 134, 11, 0.1);
    border: 2px solid var(--warning-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.unlock-prompt h4 {
    color: var(--warning-color);
    margin-bottom: 0.5rem;
}

.unlock-prompt p {
    color: var(--warning-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    background: var(--surface);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 93, 35, 0.1);
}

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

.form-error {
    color: var(--danger-color);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.form-help {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* File upload */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: var(--surface);
    transition: all 0.2s;
    cursor: pointer;
}

.file-upload:hover,
.file-upload.dragover {
    border-color: var(--primary-color);
    background: rgba(74, 93, 35, 0.05);
}

.file-upload input[type="file"] {
    display: none;
}

.upload-text {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

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

.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

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

.remove-file {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: rgba(160, 82, 45, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.remove-file:hover {
    background: var(--danger-color);
}

/* Post form */
.post-form {
    background: var(--surface);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(74, 93, 35, 0.05);
    margin: 2rem 0;
    border: 1px solid var(--border-color);
}

.post-form h2 {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-full {
    grid-column: 1 / -1;
}

/* Alerts with military colors */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(107, 142, 35, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.alert-error {
    background: rgba(160, 82, 45, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.alert-warning {
    background: rgba(184, 134, 11, 0.1);
    border: 1px solid var(--warning-color);
    color: var(--warning-color);
}

.alert-info {
    background: rgba(74, 93, 35, 0.1);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

/* Why Dollar page */
.why-dollar {
    background: var(--surface);
    padding: 3rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(74, 93, 35, 0.05);
    margin: 2rem 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--border-color);
}

.why-dollar h2 {
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
}

.why-dollar h3 {
    color: var(--primary-color);
    margin: 2rem 0 1rem;
}

.why-dollar p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.feature {
    text-align: center;
    padding: 1.5rem;
    background: rgba(74, 93, 35, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(74, 93, 35, 0.1);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.feature h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.feature p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Footer - Military dark theme */
.footer {
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--secondary-color) 100%);
    color: #d1d5db;
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: white;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 1rem;
    text-align: center;
    color: #9ca3af;
}

/* No results */
.no-results {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.no-results h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.no-results a {
    color: var(--primary-color);
    text-decoration: none;
}

.no-results a:hover {
    text-decoration: underline;
}

/* Loading states */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* COMPACT MOBILE RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header-content {
        flex-direction: row; /* Keep logo and buttons on same row */
        gap: 1rem;
        padding: 0.75rem 0;
        min-height: auto;
        justify-content: space-between;
    }
    
    .logo a {
        font-size: 1.3rem; /* Slightly smaller on mobile */
    }
    
    /* BUTTONS SIDE BY SIDE - EVEN MORE COMPACT NOW */
    .header-actions {
        gap: 0.5rem;
        flex-shrink: 0;
    }
    
    .header-actions .btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
    }
    
    .header {
        box-shadow: 0 1px 4px rgba(74, 93, 35, 0.1);
    }
    
    /* Hero section mobile */
    .hero {
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    .btn-large {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        width: 100%;
        max-width: 280px;
    }
    
    /* MOBILE FILTER LAYOUT - Keep side by side but more compact */
    .filter-form {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group {
        flex-direction: row; /* Keep horizontal on mobile too */
        width: 100%;
        gap: 0.75rem;
    }
    
    .filter-form input,
    .filter-form select {
        min-width: 80px; /* Smaller minimum for mobile */
        font-size: 0.85rem;
        padding: 0.6rem;
    }
    
    .filter-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .filter-buttons .btn {
        flex: 1;
        max-width: 120px;
    }
    
    .listings-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .item-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .item-sidebar {
        order: -1;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .item-meta {
        flex-direction: column;
        gap: 1rem;
    }
    
    .thumbnail-grid {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    }
    
    .thumbnail {
        width: 60px;
        height: 60px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .header-content {
        gap: 0.5rem;
        padding: 0.6rem 0;
    }
    
    .logo a {
        font-size: 1.3rem;
    }
    
    .header-nav {
        gap: 0.75rem;
    }
    
    .nav-link {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    .header-actions .btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.6rem;
        max-width: 120px;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero h2 {
        font-size: 1.75rem;
    }
    
    .item-title {
        font-size: 1.5rem;
    }
    
    .item-price {
        font-size: 2rem;
    }
    
    .post-form,
    .why-dollar {
        padding: 1.5rem;
        margin: 1rem 0;
    }
    
    .main-image {
        height: 250px;
    }
}