/* ========================================
   BASE STYLES
   ======================================== */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* ========================================
   NAVIGATION
   ======================================== */

.nav {
    background: white;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2563eb;
    letter-spacing: -0.02em;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.nav-link {
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #525252;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.nav-link:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.nav-user {
    font-size: 0.875rem;
    color: #737373;
    white-space: nowrap;
}

/* ========================================
   MAIN CONTAINER
   ======================================== */

.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ========================================
   HEADINGS
   ======================================== */

h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.page-title {
    font-size: 1.75rem;
    margin-bottom: 24px;
    color: #1a1a1a;
}

.section-title {
    font-size: 1.25rem;
    margin-bottom: 20px;
    color: #1a1a1a;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: white;
    color: #1a1a1a;
    border: 1px solid #d4d4d4;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #a3a3a3;
}

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

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8125rem;
}

/* ========================================
   CARDS
   ======================================== */

.card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* ========================================
   GRID LAYOUTS
   ======================================== */

.grid {
    display: grid;
    gap: 20px;
}

.grid-3 {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

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

/* ========================================
   LISTING CARD
   ======================================== */

.listing-card {
    display: flex;
    flex-direction: column;
}

.listing-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f5f5f5;
}

.listing-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.listing-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1a1a1a;
}

.listing-card-title:hover {
    color: #2563eb;
}

.listing-card-desc {
    font-size: 0.875rem;
    color: #737373;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listing-card-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2563eb;
    margin-top: auto;
}

.listing-card-link {
    margin-top: 12px;
}

/* ========================================
   AUTH FORM
   ======================================== */

.auth-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 40px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
}

.auth-title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 32px;
    color: #1a1a1a;
}

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

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: #525252;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    background: white;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-submit {
    width: 100%;
    margin-top: 8px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.875rem;
    color: #737373;
}

.auth-footer a {
    color: #2563eb;
    font-weight: 500;
}

/* ========================================
   ALERTS
   ======================================== */

.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 0.9375rem;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ========================================
   DETAIL PAGE
   ======================================== */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.detail-image {
    width: 100%;
    border-radius: 12px;
    background: #f5f5f5;
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.detail-meta {
    font-size: 0.9375rem;
    color: #737373;
}

.detail-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2563eb;
}

.bid-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.bid-input {
    width: 140px;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
}

.bid-info {
    font-size: 0.9375rem;
    color: #737373;
}

.bid-info .winning {
    color: #059669;
    font-weight: 600;
}

.action-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* ========================================
   COMMENTS
   ======================================== */

.comments {
    margin-top: 40px;
}

.comments-title {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.comment {
    padding: 20px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    margin-bottom: 16px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

.comment-author {
    font-weight: 600;
    color: #1a1a1a;
}

.comment-date {
    color: #a3a3a3;
}

.comment-text {
    color: #525252;
    line-height: 1.6;
}

.comment-form {
    padding: 24px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    margin-top: 24px;
}

.comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 16px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========================================
   CATEGORIES
   ======================================== */

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

.category-card {
    padding: 24px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    color: #525252;
    transition: all 0.15s ease;
}

.category-card:hover {
    border-color: #2563eb;
    color: #2563eb;
    background: #f8fafc;
}

/* ========================================
   WATCHLIST
   ======================================== */

.watchlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    margin-bottom: 12px;
    transition: box-shadow 0.15s ease;
}

.watchlist-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.watchlist-item a {
    font-weight: 500;
    color: #1a1a1a;
}

.watchlist-item a:hover {
    color: #2563eb;
}

.watchlist-item .price {
    font-weight: 600;
    color: #2563eb;
}

/* ========================================
   CREATE LISTING
   ======================================== */

.create-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 32px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
}

.create-form .form-group {
    margin-bottom: 24px;
}

.create-form .btn {
    margin-top: 8px;
}

/* ========================================
   BADGES
   ======================================== */

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-closed {
    background: #525252;
    color: white;
}

/* ========================================
   PLACEHOLDERS
   ======================================== */

.placeholder {
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a3a3a3;
    font-size: 0.875rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .nav-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 16px 16px;
        gap: 12px;
    }

    .nav-menu {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .grid-3, .grid-2 {
        grid-template-columns: 1fr;
    }

    .auth-container {
        margin: 24px 16px;
        padding: 24px;
    }
}