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

body {
    min-height: 100vh;
    font-family: 'Times New Roman', Times, serif;
    background-color: #f4f4f5;
    color: #333;
    display: flex;
    flex-direction: column;
}

/* --- NAVIGATION --- */
nav {
    background-color: rgb(8, 4, 48);
}

nav ul {
    width: 100%;
    list-style: none;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

nav li {
    height: 50px;
}

nav a {
    height: 100%;
    padding: 0 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    color: rgb(183, 181, 196);
    transition: background-color 0.2s ease, color 0.2s ease;
}

nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

nav li:first-child {
    margin-right: auto;
}

/* --- CART BADGE --- */
.cart-badge {
    background-color: #e63946;
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 1px 6px;
    margin-left: 4px;
    display: none;
}

.cart-badge.visible {
    display: inline;
}

/* --- SIDEBAR --- */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 250px;
    z-index: 999;
    background-color: rgb(8, 4, 48);
    display: none;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    box-shadow: -5px 0 15px rgba(0,0,0,0.5);
}

.sidebar li {
    width: 100%;
}

.sidebar a {
    width: 100%;
}

.menu-button {
    display: none;
}

/* --- HERO & CATEGORIES --- */
.hero, .categories {
    text-align: center;
    padding: 40px 20px;
    background-color: white;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.hero h2 {
    margin-bottom: 15px;
    font-size: 2rem;
}

.brands {
    margin-top: 15px;
}

button {
    padding: 10px 20px;
    border-radius: 5px;
    border: 2px solid black;
    background-color: black;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover {
    background-color: white;
    color: black;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.brands button {
    background-color: white;
    color: black;
    margin: 0 5px;
}

.brands button:hover {
    background-color: black;
    color: white;
}

/* --- FILTER BAR --- */
.filter-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background-color: white;
    color: black;
    border: 2px solid #ccc;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.filter-btn:hover,
.filter-btn.active {
    background-color: rgb(8, 4, 48);
    color: white;
    border-color: rgb(8, 4, 48);
}

/* --- PRODUCT GRID --- */
.listings {
    padding: 20px;
    text-align: center;
    flex: 1;
}

#listing-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    padding: 20px 10%;
    margin-top: 15px;
}

.loading-text {
    grid-column: 1 / -1;
    color: #888;
    font-style: italic;
    padding: 40px 0;
}

.card {
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

.card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.card h3 {
    margin-bottom: 6px;
}

.card .card-price {
    font-weight: bold;
    margin: 6px 0 12px;
    font-size: 1.05rem;
}

.card .brand-tag {
    display: inline-block;
    background: #f0f0f0;
    border-radius: 12px;
    padding: 2px 10px;
    font-size: 0.78rem;
    color: #555;
    margin-bottom: 10px;
}

.card .add-to-cart-btn {
    margin-top: auto;
    width: 100%;
    border-radius: 5px;
}

/* --- LOGIN / REGISTER FORM --- */
#grid {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    flex: 1;
}

.login-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.login-form label {
    display: block;
    margin-top: 15px;
    font-weight: bold;
}

.login-form input {
    width: 100%;
    padding: 12px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.login-form input:focus {
    border-color: rgb(8, 4, 48);
}

.login-form button {
    width: 100%;
    margin-top: 25px;
    border-radius: 50px;
}

#center-text {
    text-align: center;
    margin-top: 15px;
}

#register-link, #login-link {
    text-decoration: none;
    color: rgb(8, 4, 48);
    font-weight: bold;
}

/* --- FORM FEEDBACK --- */
.form-error {
    background: #ffe5e5;
    color: #c0392b;
    border: 1px solid #f5c6c6;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.form-success {
    background: #e5ffe8;
    color: #1a7a2e;
    border: 1px solid #b2e8ba;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

/* --- CART PAGE --- */
.cart-section {
    padding: 30px 10%;
    flex: 1;
}

.cart-section h2 {
    margin-bottom: 20px;
    text-align: center;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 20px;
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.cart-item img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.cart-item-info p {
    color: #555;
    font-size: 0.9rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn {
    background: white;
    color: black;
    border: 2px solid black;
    padding: 4px 10px;
    font-size: 1rem;
    border-radius: 4px;
    line-height: 1;
}

.qty-btn:hover {
    background: black;
    color: white;
}

.qty-display {
    font-weight: bold;
    min-width: 24px;
    text-align: center;
}

.remove-btn {
    background: white;
    color: #e63946;
    border: 2px solid #e63946;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.remove-btn:hover {
    background: #e63946;
    color: white;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: bold;
    padding: 20px 0;
    border-top: 2px solid #ddd;
    margin-top: 10px;
}

#cart-summary {
    max-width: 500px;
    margin: 0 auto;
}

#checkout-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    border-radius: 8px;
}

.btn-outline {
    width: 100%;
    background: white;
    color: black;
    border: 2px solid black;
    padding: 10px;
    border-radius: 8px;
}

.btn-outline:hover {
    background: black;
    color: white;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.cart-empty p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

/* --- FOOTER --- */
footer {
    text-align: center;
    padding: 20px;
    background-color: rgb(8, 4, 48);
    color: white;
    margin-top: auto;
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
    .hideOnMobile {
        display: none;
    }
    .menu-button {
        display: block;
    }
    .sidebar {
        width: 100%;
    }
    #listing-container {
        padding: 20px 5%;
    }
    .cart-section {
        padding: 20px 5%;
    }
    .cart-item {
        flex-wrap: wrap;
    }
}

/* ── Role Selector ─────────────────────────────────────────── */
.role-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.role-selector input[type="radio"] {
    display: none;
}

.role-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border: 2px solid #ccc;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    color: #555;
    background: white;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    font-size: 0.9rem;
}

.role-option svg {
    width: 28px;
    height: 28px;
}

.role-selector input[type="radio"]:checked + .role-option {
    border-color: rgb(8, 4, 48);
    color: rgb(8, 4, 48);
    background: #f4f4f5;
}

.role-option:hover {
    border-color: rgb(8, 4, 48);
    color: rgb(8, 4, 48);
}

/* --- MY ORDERS (buyer) --- */
.order-status {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: bold;
}
.status-pending   { background:#eef0f3; color:#555; }
.status-escrow    { background:#eef0f3; color:#555; }
.status-shipped   { background:#e8eef7; color:rgb(8,4,48); }
.status-confirmed { background:#e6efe9; color:#1a7a2e; }
.status-released  { background:#e6efe9; color:#1a7a2e; }
.status-disputed  { background:#f6e9e9; color:#c0392b; }
.status-refunded  { background:#eef0f3; color:#555; }
