/* Marknadstorget - Huvudstil */

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --text: #1e293b;
    --text-light: #64748b;
}

* {
    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: var(--text);
    background: var(--bg);
}

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

/* Header & Navigation */
header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 24px;
    list-style: none;
    align-items: center;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
    font-weight: 500;
}

.btn:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
}

.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: var(--success);
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

/* Flash Messages */
.flash {
    padding: 16px 20px;
    margin: 20px 0;
    border-radius: 6px;
    border-left: 4px solid;
}

.flash-success {
    background: #d1fae5;
    color: #065f46;
    border-color: var(--success);
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
    border-color: var(--error);
}

.flash-info {
    background: #dbeafe;
    color: #1e40af;
    border-color: var(--primary);
}

.flash-warning {
    background: #fef3c7;
    color: #92400e;
    border-color: var(--warning);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

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

.error-message {
    color: var(--error);
    font-size: 14px;
    margin-top: 4px;
}

/* Search Box */
.search-box {
    background: white;
    padding: 32px;
    border-radius: 8px;
    margin: 32px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-form {
    display: grid;
    gap: 16px;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Listings Grid */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

.listing-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

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

.listing-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg);
}

.listing-body {
    padding: 16px;
}

.listing-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
    text-decoration: none;
    display: block;
}

.listing-title:hover {
    color: var(--primary);
}

.listing-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.listing-meta {
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.favorite-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

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

.favorite-btn.active {
    color: var(--error);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 32px 0;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Image Gallery */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.gallery-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
}

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

.delete-image {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--error);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
}

/* Messages */
.message-thread {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.message-item {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 6px;
    background: var(--bg);
}

.message-item.own {
    background: #dbeafe;
    margin-left: 40px;
}

.message-item.other {
    background: #f1f5f9;
    margin-right: 40px;
}

.message-meta {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 4px;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

.status-aktiv {
    background: #d1fae5;
    color: #065f46;
}

.status-pausad {
    background: #fef3c7;
    color: #92400e;
}

.status-såld {
    background: #e2e8f0;
    color: #475569;
}

/* Responsive */
@media (max-width: 768px) {
    .search-row {
        grid-template-columns: 1fr;
    }
    
    .filters {
        grid-template-columns: 1fr;
    }
    
    .listings-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        flex-wrap: wrap;
        gap: 12px;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-3 { padding: 24px; }

.card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
