/* ===== Basic page setup ===== */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f4f8;
    color: #333;
}

/* ===== Header ===== */
header {
    background-color: #2c7a7b;
    color: white;
    padding: 8px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 20px;
}

.top-image {
    width: 600px;
    height: auto;
    max-width: 100%;
    border-radius: 0;
}

.toptitle {
    font-size: 36px;
    margin: 10px 0;
}

/* ===== Navigation Menu ===== */
nav {
    background-color: #285e61;
    padding: 10px;
    border-radius: 6px;
    margin-top: 15px;
}

nav h1 {
    font-size: 18px;
    margin: 5px 0;
}

nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background-color: #38a169;
    border-radius: 4px;
    display: inline-block;
}

nav a:hover {
    background-color: #2f855a;
}

/* ===== Layout: aside + article side by side (flexbox) ===== */
.main-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* ===== Aside (sidebar) ===== */
aside {
    width: 280px;
    flex-shrink: 0;
    background-color: white;
    padding: 15px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
}

aside h1 {
    font-size: 20px;
    color: #2c7a7b;
    border-bottom: 2px solid #2c7a7b;
    padding-bottom: 5px;
}

aside div {
    background-color: #edf2f7;
    padding: 10px;
    margin-bottom: 12px;
    border-radius: 6px;
}

aside h2 {
    font-size: 16px;
    margin-top: 0;
    color: #2d3748;
}

aside ul {
    padding-left: 18px;
}

.quote {
    background-color: #fefcbf !important;
    border-left: 4px solid #d69e2e;
    font-style: italic;
}

/* ===== Article (main content) ===== */
article {
    flex: 1;
}

section {
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
}

.section0 {
    background-color: #2c7a7b;
    color: white;
    text-align: center;
}

.section0 p {
    font-size: 22px;
    font-weight: bold;
}

.section1 {
    background-color: white;
}

.section2 {
    background-color: #e6fffa;
}

section h2 {
    color: #2c7a7b;
    margin-top: 0;
}

.body-list {
    list-style: square;
    text-align: left;
    display: inline-block;
}

/* ===== Search / filter bar ===== */
.search-bar {
    margin-bottom: 15px;
}

.search-bar input {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
}

/* ===== Sign Up form ===== */
form input {
    width: 100%;
    padding: 8px;
    margin: 5px 0;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
}

#signupMessage {
    font-weight: bold;
    margin-top: 10px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    margin-top: 10px;
    background-color: #38a169;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn:hover {
    background-color: #2f855a;
}

.btn-secondary {
    background-color: #4299e1;
}

.btn-secondary:hover {
    background-color: #2b6cb0;
}

/* ===== Browse page cards (browse.php) ===== */
.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.card {
    background-color: white;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 15px;
    width: 220px;
}

.card h2 {
    color: #2c7a7b;
    margin-top: 0;
    font-size: 18px;
}

/* Item photo on each browse card */
.card-img {
    width: 100%;
    height: 160px;
    object-fit: cover;        /* fill the box without stretching */
    border-radius: 6px;
    margin-bottom: 10px;
    background-color: #edf2f7; /* shows while the image loads */
}

/* ===== Card extra details (browse.php) ===== */
.card-cat {
    display: inline-block;
    background-color: #e6fffa;
    color: #285e61;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: bold;
}

.card-price {
    color: #38a169;
    font-weight: bold;
    font-size: 18px;
}

.card-owner {
    color: #718096;
    font-size: 13px;
    font-style: italic;
}

/* ===== Shared top navigation bar ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    background-color: #285e61;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.topbar-brand {
    color: white;
    font-size: 20px;
    font-weight: bold;
    text-decoration: none;
}

.topbar-links a {
    color: white;
    text-decoration: none;
    padding: 8px 14px;
    background-color: #38a169;
    border-radius: 4px;
    margin-left: 8px;
    display: inline-block;
}

.topbar-links a:hover {
    background-color: #2f855a;
}

/* ===== Login / register / upload / edit forms ===== */
.auth-form {
    max-width: 420px;
    margin: 40px auto;
    background-color: white;
    padding: 30px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.auth-form h2 {
    color: #2c7a7b;
    margin-top: 0;
    text-align: center;
}

.auth-input {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 15px;
    font-family: Arial, sans-serif;
}

.auth-form input.btn {
    width: 100%;
    margin-top: 12px;
}

.auth-form p {
    text-align: center;
    margin: 10px 0 0;
}

.auth-form a {
    color: #2c7a7b;
}

/* ===== Category filter bar (browse.php) ===== */
.filter-bar {
    background-color: white;
    padding: 12px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    margin-bottom: 18px;
}

.filter-bar select {
    padding: 8px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 15px;
}

/* ===== My Items table ===== */
.list-section {
    background-color: white;
    padding: 25px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
}

.list-section h2 {
    color: #2c7a7b;
    margin-top: 0;
}

.content-table {
    border-collapse: collapse;
    width: 100%;
    margin: 20px 0;
    font-size: 15px;
    box-shadow: 0 0 14px rgba(0, 0, 0, 0.08);
}

.content-table thead tr {
    background-color: #2c7a7b;
    color: white;
    text-align: left;
}

.content-table th,
.content-table td {
    padding: 10px 14px;
}

.content-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
}

.content-table tbody tr:nth-of-type(even) {
    background-color: #f0f4f8;
}

.link-edit {
    color: #2b6cb0;
    text-decoration: none;
    margin-right: 10px;
}

.link-delete {
    color: #c53030;
    text-decoration: none;
}

.link-edit:hover,
.link-delete:hover {
    text-decoration: underline;
}

/* ===== Message / error boxes ===== */
.message-box {
    max-width: 420px;
    margin: 60px auto;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    background-color: white;
    border: 1px solid #cbd5e0;
}

.error-box {
    border-top: 5px solid #c53030;
}

.message-box h2 {
    color: #c53030;
    margin-top: 0;
}

/* ===== Mobile layout (under 600px) ===== */
@media (max-width: 600px) {
    .main-content {
        flex-direction: column;
    }

    aside {
        width: 100%;
        box-sizing: border-box;
    }

    .top-image {
        width: 100%;
    }

    /* Stack the nav bar items on small screens */
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .topbar-links a {
        margin-left: 0;
        margin-right: 6px;
    }

    /* Let the item cards fill the width on mobile */
    .card {
        width: 100%;
        box-sizing: border-box;
    }

    /* Allow the table to scroll sideways instead of breaking the layout */
    .list-section {
        overflow-x: auto;
    }
}
