
/* =========================
   1. Global
========================= */

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

body {
    font-family: "Segoe UI", system-ui, sans-serif;
    background: #F8FAFC;
    color: #0F172A;
    line-height: 1.6;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

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

.container {
    width: 90%;
    max-width: 1280px;
    margin: 0 auto;
}

/* =========================
   2. Navbar
========================= */

.navbar {
    width: 100%;
    background: #FFFFFF;
    border-bottom: 1px solid #E2E8F0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.logo {
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -1px;
    color: #0F172A;
    white-space: nowrap;
}

.logo span {
    color: #2563EB;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    color: #475569;
    font-size: 15px;
    font-weight: 600;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #2563EB;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-icon {
    color: #475569;
    font-size: 14px;
    font-weight: 600;
}

.nav-icon:hover {
    color: #2563EB;
}

.btn-login {
    font-size: 14px;
    font-weight: 600;
    color: #2563EB;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563EB;
    color: #FFFFFF;
    padding: 11px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-primary:hover {
    background: #1D4ED8;
}

/* =========================
   3. Main
========================= */

main {
    min-height: 75vh;
}

/* =========================
   4. Footer
========================= */

.footer {
    margin-top: 60px;
    padding: 28px 0;
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    color: #64748B;
    font-size: 14px;
}

/* =========================
   5. Responsive
========================= */

@media (max-width: 900px) {
    .navbar-inner {
        flex-wrap: wrap;
        padding: 15px 0;
        gap: 15px;
    }

    .nav-links {
        gap: 18px;
    }

    .nav-actions {
        gap: 12px;
    }
}

@media (max-width: 600px) {
    .container {
        width: 92%;
    }

    .navbar-inner {
        justify-content: space-between;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .nav-links a {
        font-size: 13px;
    }

    .nav-actions {
        gap: 10px;
    }

    .nav-icon {
        display: none;
    }

    .btn-login {
        font-size: 13px;
    }

    .btn-primary {
        padding: 9px 12px;
        font-size: 12px;
    }

    .logo {
        font-size: 21px;
    }
}



/* =========================
   6. Hero Section
========================= */

.hero {
    background: #FFFFFF;
    padding: 75px 0 85px;
    overflow: hidden;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
}

.hero-text {
    flex: 1;
}

.hero-label,
.section-label {
    display: inline-block;
    color: #2563EB;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.5px;
    margin-bottom: 16px;
}

.hero-text h1 {
    font-size: clamp(36px, 5vw, 58px);
    line-height: 1.15;
    letter-spacing: -2px;
    font-weight: 800;
    margin-bottom: 22px;
}

.hero-text h1 span {
    color: #2563EB;
}

.hero-text p {
    color: #64748B;
    font-size: 17px;
    max-width: 480px;
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    align-items: center;
    gap: 14px;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 20px;
    border: 1px solid #CBD5E1;
    border-radius: 8px;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
}

.btn-outline:hover {
    border-color: #2563EB;
    color: #2563EB;
}

/* Hero Book Illustration */

.hero-visual {
    flex: 0 0 380px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
    background: #EFF6FF;
    border-radius: 30px;
}

.hero-book {
    width: 210px;
    height: 280px;
    padding: 25px;
    background: #2563EB;
    color: white;
    border-radius: 5px 14px 14px 5px;
    box-shadow: 14px 15px 30px rgba(15, 23, 42, 0.2);
    transform: rotate(-5deg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hero-book span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
}

.hero-book h2 {
    font-size: 31px;
    line-height: 1.1;
    letter-spacing: 1px;
}

.hero-book p {
    font-size: 11px;
    opacity: 0.8;
}

/* =========================
   7. Search Section
========================= */

.search-section {
    padding: 30px 0;
    background: #F8FAFC;
}

.search-form {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    background: white;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 7px;
    box-shadow: 0 5px 20px rgba(15, 23, 42, 0.04);
}

.search-form input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    padding: 12px 16px;
    font-size: 15px;
    background: transparent;
}

.search-form button {
    border: none;
    background: #2563EB;
    color: white;
    padding: 0 28px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.search-form button:hover {
    background: #1D4ED8;
}

/* =========================
   8. Categories
========================= */

.categories-section,
.recent-section {
    padding: 65px 0;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 30px;
}

.section-heading h2 {
    font-size: 28px;
    letter-spacing: -0.7px;
}

.text-link {
    color: #2563EB;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.category-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 22px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    transition: 0.2s;
}

.category-card:hover {
    border-color: #2563EB;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.category-card span {
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #EFF6FF;
    border-radius: 10px;
    font-size: 23px;
}

.category-card h3 {
    font-size: 15px;
    font-weight: 700;
}

/* =========================
   9. Empty State
========================= */

.empty-state {
    padding: 65px 20px;
    text-align: center;
    background: #FFFFFF;
    border: 1px dashed #CBD5E1;
    border-radius: 16px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-state h3 {
    font-size: 21px;
    margin-bottom: 8px;
}

.empty-state p {
    color: #64748B;
    max-width: 430px;
    margin: 0 auto 22px;
    font-size: 14px;
}

/* =========================
   10. Community Section
========================= */

.community-section {
    padding: 65px 0;
    background: #EFF6FF;
}

.community-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.community-content h2 {
    font-size: 34px;
    margin-bottom: 12px;
}

.community-content p {
    color: #64748B;
    max-width: 480px;
    margin-bottom: 25px;
}

.community-decoration {
    display: flex;
    flex-direction: column;
    font-size: 44px;
    font-weight: 900;
    line-height: 1.1;
    color: #2563EB;
    opacity: 0.8;
    letter-spacing: -2px;
}

/* =========================
   11. Responsive Home
========================= */

@media (max-width: 900px) {
    .hero-content {
        gap: 25px;
    }

    .hero-visual {
        flex-basis: 300px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .hero {
        padding: 45px 0;
    }

    .hero-content {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-text h1 {
        font-size: 39px;
    }

    .hero-text p {
        font-size: 15px;
    }

    .hero-visual {
        min-height: 280px;
        flex-basis: auto;
    }

    .hero-book {
        width: 175px;
        height: 235px;
    }

    .hero-book h2 {
        font-size: 26px;
    }

    .categories-section,
    .recent-section {
        padding: 45px 0;
    }

    .section-heading {
        align-items: flex-start;
    }

    .section-heading h2 {
        font-size: 23px;
    }

    .category-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .category-card {
        padding: 13px 10px;
        gap: 9px;
    }

    .category-card span {
        width: 38px;
        height: 38px;
        font-size: 19px;
        flex-shrink: 0;
    }

    .category-card h3 {
        font-size: 12px;
    }

    .community-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .community-content h2 {
        font-size: 28px;
    }

    .community-decoration {
        font-size: 35px;
    }

    .search-form input {
        font-size: 13px;
    }

    .search-form button {
        padding: 0 18px;
    }
}



/* =========================
   12. Book Listing Cards
========================= */

.book-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
}

.book-card {
    min-width: 0;
    overflow: hidden;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    transition: 0.2s ease;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.book-image {
    width: 100%;
    height: 240px;
    overflow: hidden;
    background: #F1F5F9;
}

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

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
}

.no-image span {
    font-size: 42px;
    margin-bottom: 8px;
}

.no-image p {
    font-size: 13px;
}

.book-info {
    padding: 17px;
}

.book-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.book-condition {
    display: inline-block;
    padding: 4px 9px;
    background: #EFF6FF;
    color: #2563EB;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
}

.book-info h3 {
    margin-top: 12px;
    font-size: 16px;
    line-height: 1.4;
    min-height: 44px;
    overflow-wrap: anywhere;
}

.book-author {
    margin-top: 5px;
    color: #64748B;
    font-size: 13px;
}

.book-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 18px;
}

.book-card-bottom strong {
    color: #2563EB;
    font-size: 18px;
}

.book-card-bottom span {
    color: #64748B;
    font-size: 11px;
}

.seller-name {
    border-top: 1px solid #E2E8F0;
    padding-top: 12px;
    margin-top: 12px;
    color: #64748B;
    font-size: 12px;
}

/* Responsive book grid */

@media (max-width: 1000px) {
    .book-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .book-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .book-image {
        height: 190px;
    }

    .book-info {
        padding: 12px;
    }

    .book-info h3 {
        font-size: 14px;
    }

    .book-card-bottom {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* ===== BOOK CATALOG ===== */

.catalog-section {
    padding: 55px 0 80px;
    background: #f8fafc;
    min-height: 70vh;
}

.catalog-header {
    margin-bottom: 30px;
}

.catalog-header h1 {
    font-size: 36px;
    color: #0f172a;
    margin: 10px 0;
}

.catalog-header p {
    color: #64748b;
}

.catalog-search {
    display: flex;
    gap: 10px;
    margin-bottom: 35px;
}

.catalog-search input {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
}

.catalog-search input:focus {
    border-color: #2563eb;
}

.catalog-search button {
    padding: 0 25px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.catalog-layout {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 30px;
    align-items: start;
}

.category-sidebar {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
}

.category-sidebar h3 {
    margin-bottom: 15px;
    color: #0f172a;
}

.category-sidebar a {
    display: block;
    padding: 10px 12px;
    margin-bottom: 4px;
    color: #64748b;
    border-radius: 7px;
    text-decoration: none;
    font-size: 14px;
}

.category-sidebar a:hover,
.category-sidebar a.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.catalog-results {
    min-width: 0;
}

.catalog-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.catalog-results-header h2 {
    font-size: 21px;
    color: #0f172a;
}

.catalog-results-header span {
    color: #64748b;
    font-size: 14px;
}

/* Responsive */

@media (max-width: 768px) {
    .catalog-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .category-sidebar {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .category-sidebar h3 {
        width: 100%;
    }

    .category-sidebar a {
        margin: 0;
    }

    .catalog-header h1 {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .catalog-search {
        gap: 6px;
    }

    .catalog-search button {
        padding: 0 16px;
    }

    .catalog-results-header h2 {
        font-size: 18px;
    }
}

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

.create-section {
    padding: 55px 0 80px;
    background: #f8fafc;
    min-height: 75vh;
}

.create-header {
    margin-bottom: 30px;
}

.create-header h1 {
    font-size: 34px;
    color: #0f172a;
    margin: 10px 0;
}

.create-header p {
    color: #64748b;
}

.create-form {
    max-width: 750px;
    background: white;
    padding: 35px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    background: white;
}

.form-group input[type="checkbox"],
.form-group input[type="radio"],
.form-group input[type="file"] {
    width: auto;
    padding: 0;
    border: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #2563eb;
}

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

.form-errors {
    padding: 14px;
    margin-bottom: 22px;
    color: #b91c1c;
    background: #fef2f2;
    border-radius: 8px;
    font-size: 14px;
}

.create-submit {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
}

@media (max-width: 600px) {
    .create-form {
        padding: 22px 16px;
    }

    .create-header h1 {
        font-size: 27px;
    }
}


/* ===== BOOK CARD LINK ===== */

.book-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.book-card-link:hover {
    color: inherit;
}

.book-card-link .book-card {
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card-link:hover .book-card {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.10);
}

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

.detail-section {
    padding: 45px 0 80px;
    background: #f8fafc;
    min-height: 75vh;
}

.back-link {
    display: inline-block;
    margin-bottom: 25px;
    color: #2563eb;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 45px;
    align-items: start;
    background: white;
    padding: 35px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.detail-image {
    min-height: 400px;
    background: #f1f5f9;
    border-radius: 12px;
    overflow: hidden;
}

.detail-image img {
    width: 100%;
    height: 450px;
    object-fit: contain;
    display: block;
}

.detail-no-image {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
}

.detail-no-image span {
    font-size: 70px;
}

.detail-info h1 {
    margin: 15px 0 8px;
    font-size: 32px;
    color: #0f172a;
}

.detail-author {
    color: #64748b;
    margin-bottom: 20px;
}

.detail-price {
    color: #2563eb;
    font-size: 30px;
    margin-bottom: 25px;
}

.detail-meta {
    padding: 18px 0;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.detail-meta p {
    margin: 10px 0;
    color: #64748b;
    font-size: 14px;
}

.detail-meta strong {
    color: #334155;
}

.detail-description {
    margin-top: 25px;
}

.detail-description h3,
.seller-box h3 {
    margin-bottom: 12px;
    color: #0f172a;
}

.detail-description p {
    color: #64748b;
    line-height: 1.7;
}

.seller-box {
    margin-top: 25px;
    padding: 18px;
    background: #f8fafc;
    border-radius: 10px;
}

.seller-box p {
    color: #334155;
}

.detail-chat-btn {
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .detail-layout {
        grid-template-columns: 1fr;
        gap: 25px;
        padding: 20px;
    }

    .detail-image,
    .detail-no-image {
        min-height: 280px;
    }

    .detail-image img {
        height: 320px;
    }

    .detail-info h1 {
        font-size: 25px;
    }
}


/* ===== AUTH PAGES ===== */

.auth-section {
    min-height: 75vh;
    padding: 60px 20px;
    background: #f8fafc;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-container {
    width: 100%;
    max-width: 480px;
    padding: 35px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header .logo {
    display: inline-block;
    margin-bottom: 25px;
    font-size: 25px;
    font-weight: 800;
    color: #0f172a;
    text-decoration: none;
}

.auth-header h1 {
    color: #0f172a;
    font-size: 27px;
    margin-bottom: 8px;
}

.auth-header p {
    color: #64748b;
    font-size: 14px;
}

.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-submit {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
}

.auth-footer {
    margin-top: 25px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

.auth-footer a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

@media (max-width: 480px) {
    .auth-container {
        padding: 25px 18px;
    }
}

/* PROFILE PAGE */

.profile-section {
    padding: 40px 0 70px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 25px;
    padding: 30px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin-bottom: 40px;
}

.profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info h1 {
    font-size: 26px;
    margin-bottom: 8px;
}

.profile-info p {
    color: #64748b;
    margin: 5px 0;
}

.profile-listings {
    margin-top: 36px;
}

.profile-listings h2 {
    font-size: 23px;
    margin-bottom: 25px;
}

@media (max-width: 600px) {
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-avatar {
        width: 75px;
        height: 75px;
    }
}

/* PROFILE EDIT PAGE */

.profile-edit-section {
    padding: 50px 0 70px;
}

.profile-edit-card {
    max-width: 650px;
    margin: 0 auto;
    padding: 35px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
}

.profile-edit-card h1 {
    font-size: 27px;
    margin-bottom: 8px;
}

.profile-edit-card > p {
    color: #64748b;
    margin-bottom: 30px;
}

.profile-edit-card .form-group {
    margin-bottom: 22px;
}

.profile-edit-card .form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.profile-edit-card input,
.profile-edit-card textarea,
.profile-edit-card select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font: inherit;
}

.profile-edit-card input:focus,
.profile-edit-card textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.profile-edit-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 25px;
}

.profile-edit-actions .create-submit {
    width: auto;
    padding: 12px 25px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .profile-edit-card {
        padding: 22px;
    }

    .profile-edit-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-edit-actions .create-submit {
        width: 100%;
    }
}

/* PROFILE STATISTICS */

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 40px;
}

.stat-card {
    padding: 24px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    text-align: center;
    transition: 0.2s ease;
}

.stat-card:hover {
    border-color: #2563eb;
    transform: translateY(-3px);
}

.stat-card h2 {
    font-size: 30px;
    color: #2563eb;
    margin-bottom: 8px;
}

.stat-card p {
    color: #64748b;
    font-size: 14px;
    margin: 0;
}

@media (max-width: 768px) {
    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 400px) {
    .stat-card {
        padding: 18px 10px;
    }

    .stat-card h2 {
        font-size: 25px;
    }
}

/* PROFILE MENU */
.profile-menu {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 30px;
    overflow-x: auto;
}

.profile-menu-link {
    display: inline-block;
    padding: 12px 18px;
    color: #64748b;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.profile-menu-link:hover,
.profile-menu-link.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

/* MY LISTINGS HEADER */
.my-listings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}

.my-listings-header h1 {
    margin-bottom: 6px;
}

.my-listings-header p {
    color: #64748b;
    margin: 0;
}

/* EMPTY LISTINGS */
.empty-listings {
    text-align: center;
    padding: 50px 20px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

@media (max-width: 600px) {
    .my-listings-header {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* MY POSTS */
.my-posts-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 850px;
}

.my-post-card {
    padding: 22px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
}

.my-post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.my-post-header strong {
    color: #0f172a;
}

.my-post-header small {
    color: #64748b;
}

.my-post-book {
    color: #2563eb;
    font-weight: 600;
    margin-bottom: 12px;
}

.my-post-content {
    color: #334155;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.my-post-image {
    display: block;
    width: 100%;
    max-width: 500px;
    max-height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-top: 15px;
}

.my-post-stats {
    display: flex;
    gap: 20px;
    padding-top: 15px;
    margin-top: 15px;
    border-top: 1px solid #e2e8f0;
    color: #64748b;
}


/* POST ACTIONS */
.post-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-actions form {
    margin: 0;
}

.post-edit-btn,
.post-delete-btn {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.post-edit-btn {
    color: #2563eb;
}

.post-delete-btn {
    color: #dc2626;
}

.post-edit-btn:hover {
    background: #eff6ff;
}

.post-delete-btn:hover {
    background: #fef2f2;
}

@media (max-width: 600px) {
    .my-post-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* COMMUNITY LIKE BUTTON */
.post-like-btn {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #e11d48;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s ease;
}

.post-like-btn:hover {
    background: #fff1f2;
    border-color: #fda4af;
}

.my-post-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 15px;
}

.my-post-stats form {
    margin: 0;
}

/* COMMUNITY COMMENTS */
.post-comments {
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.post-comments h4 {
    margin-bottom: 14px;
    font-size: 15px;
}

.post-comment {
    padding: 12px;
    margin-bottom: 10px;
    background: #f8fafc;
    border-radius: 8px;
}

.post-comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.post-comment-header strong {
    font-size: 14px;
}

.post-comment-header small {
    color: #64748b;
    font-size: 12px;
}

.post-comment p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.no-comments {
    color: #64748b;
    font-size: 13px;
}

.comment-form {
    margin-top: 14px;
}

.comment-form textarea {
    width: 100%;
    min-height: 65px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

.comment-form button {
    margin-top: 8px;
}

/* COMMENT DELETE BUTTON */
.post-comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.post-comment-header form {
    margin: 0;
}

.comment-delete-btn {
    border: 1px solid #fecaca;
    background: #fff;
    color: #dc2626;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.comment-delete-btn:hover {
    background: #fef2f2;
}


/* Community comment dropdown */
.post-comments-dropdown {
    margin-top: 12px;
    border-top: 1px solid #e5e7eb;
    padding-top: 10px;
}

.comments-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.comments-toggle::-webkit-details-marker {
    display: none;
}

.comments-toggle:hover {
    background: #f1f5f9;
}

.comments-toggle::after {
    content: "⌄";
    transition: transform 0.2s ease;
}

.post-comments-dropdown[open] .comments-toggle::after {
    transform: rotate(180deg);
}

.post-comments-content {
    margin-top: 12px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.post-comments-content .post-comment {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
}

.post-comments-content .reply-comment {
    margin-left: 28px;
    background: #f8fafc;
    border-left: 3px solid #93c5fd;
}

.post-comments-content .comment-form {
    margin-top: 14px;
}

.post-comments-content textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    padding: 12px;
    resize: vertical;
    font: inherit;
}

.post-comments-content textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.reply-section {
    margin-top: 8px;
}

.reply-section summary {
    cursor: pointer;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
}

/* Notification */
.notification-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.notification-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.notification-item.unread {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
}

.notification-content {
    line-height: 1.6;
}

.notification-content strong {
    color: #1e40af;
}

.notification-content p {
    margin: 5px 0 0;
    font-size: 13px;
    color: #777;
}

.notification-link {
    color: #2563eb;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 600;
}

.notification-link:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .notification-item {
        align-items: flex-start;
        flex-direction: column;
    }
}

.notification-nav {
    position: relative;
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 4px;
    border-radius: 50px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* Highlight post from notification */
.my-post-card {
    scroll-margin-top: 100px;
}

.my-post-card:target {
    border: 2px solid #2563eb;
    background-color: #eff6ff;
    transition: background-color 0.3s ease;
}

.notification-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.notification-header-actions form {
    margin: 0;
}

.notification-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.notification-actions form {
    margin: 0;
}

.notification-delete-btn {
    border: none;
    background: #fee2e2;
    color: #dc2626;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.notification-delete-btn:hover {
    background: #fecaca;
}

@media (max-width: 600px) {
    .notification-actions {
        width: 100%;
        justify-content: flex-end;
    }
}



/* =========================
   CHAT
========================= */

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    text-decoration: none;
    color: #222;
    transition: 0.2s;
}

.chat-list-item:hover {
    border-color: #315efb;
    transform: translateY(-2px);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: #315efb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-info h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.chat-info p {
    margin: 0;
    color: #777;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-arrow {
    font-size: 25px;
    color: #999;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.chat-header a {
    text-decoration: none;
    color: #315efb;
    font-weight: 600;
}

.chat-header h2 {
    margin: 0;
}

.chat-box {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    overflow: hidden;
}

.chat-messages {
    height: 450px;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.message-row {
    display: flex;
    width: 100%;
}

.my-message {
    justify-content: flex-end;
}

.their-message {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 75%;
    padding: 11px 15px;
    border-radius: 14px;
    overflow-wrap: anywhere;
}

.my-message .message-bubble {
    background: #315efb;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.their-message .message-bubble {
    background: #f0f1f5;
    color: #222;
    border-bottom-left-radius: 4px;
}

.message-bubble p {
    margin: 0 0 5px;
    line-height: 1.5;
}

.message-bubble small {
    display: block;
    font-size: 11px;
    text-align: right;
    opacity: 0.7;
}

.chat-form {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #eee;
}

.chat-form input {
    flex: 1;
    min-width: 0;
    padding: 13px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
}

.chat-form input:focus {
    border-color: #315efb;
}

.chat-form button {
    padding: 12px 22px;
    border: none;
    border-radius: 25px;
    background: #315efb;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.chat-form button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#connection-status {
    padding: 0 15px 10px;
    margin: 0;
    font-size: 12px;
    color: #888;
}

@media (max-width: 600px) {
    .chat-messages {
        height: 60vh;
        padding: 12px;
    }

    .message-bubble {
        max-width: 88%;
    }
}



.detail-chat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
}

.detail-chat-btn:hover {
    cursor: pointer;
}



.chat-time {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 11px;
}



.unread-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50px;
    background: #e53935;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}



/* Chat date divider */
.chat-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 22px 0;
    width: 100%;
}

.chat-date-label {
    background: #e8edf3;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
}



/* Message actions */
.message-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.message-actions button {
    border: none;
    background: transparent;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 0;
    color: #94a3b8;
    transition: color 0.2s ease;
}

.message-actions .edit-message-btn:hover,
.message-actions .delete-message-btn:hover {
    color: #475569;
}

/* Edited message */
.edited-label {
    display: inline-block;
    margin-left: 5px;
    color: #94a3b8;
    font-size: 10px;
    font-style: italic;
}

/* Deleted message */
.deleted-message {
    color: #94a3b8;
    font-style: italic;
    font-size: 13px;
}

/* ===== SHARED UI: status, reviews, pages ===== */

.flash-wrap {
    padding-top: 20px;
}

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.flash-success {
    background: #ecfdf5;
    color: #047857;
}

.flash-error {
    background: #fef2f2;
    color: #b91c1c;
}

.flash-warning {
    background: #fffbeb;
    color: #b45309;
}

.flash-info {
    background: #eff6ff;
    color: #1d4ed8;
}

.status-badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
}

.status-available {
    background: #ecfdf5;
    color: #047857;
}

.status-reserved {
    background: #fffbeb;
    color: #b45309;
}

.status-sold,
.status-declined,
.status-cancelled {
    background: #f1f5f9;
    color: #475569;
}

.status-pending {
    background: #fffbeb;
    color: #b45309;
}

.status-accepted {
    background: #ecfdf5;
    color: #047857;
}

.offer-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.offer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.offer-actions {
    display: flex;
    gap: 8px;
}

.offer-actions .btn-primary,
.offer-actions .btn-outline {
    padding: 8px 12px;
}

.catalog-search select {
    padding: 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.catalog-search input[type="number"] {
    flex: 0 0 120px;
    width: 120px;
}

.catalog-search select[name="location"] {
    flex: 0 0 160px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
}

.pagination a,
.pagination span {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

.pagination a:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.pagination .is-current {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 20px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    background: #fff;
    color: #b91c1c;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

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

.favorite-btn {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.favorite-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.owner-panel {
    margin-top: 22px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
}

.owner-panel h3 {
    margin-bottom: 10px;
    font-size: 15px;
}

.status-switch {
    display: flex;
    gap: 8px;
}

.status-switch button {
    flex: 1;
    padding: 10px 8px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}

.status-switch button.is-active {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.owner-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.owner-actions a {
    flex: 1;
}

.seller-box a {
    color: #2563eb;
    font-weight: 700;
}

.seller-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    color: #64748b;
    font-size: 14px;
}

.stars {
    --rating: 0;
    position: relative;
    display: inline-block;
    font-size: 16px;
    letter-spacing: 2px;
    line-height: 1;
    color: #e2e8f0;
}

.stars::before,
.stars::after {
    content: "★★★★★";
}

.stars::after {
    position: absolute;
    left: 0;
    top: 0;
    width: calc(var(--rating) / 5 * 100%);
    overflow: hidden;
    color: #f59e0b;
}

.reviews-section {
    margin-top: 28px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 28px;
}

.reviews-section h2 {
    font-size: 22px;
    margin-bottom: 6px;
}

.reviews-section .section-note {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 18px;
}

.review-form {
    padding-bottom: 8px;
}

.rating-picker {
    display: flex;
    gap: 8px;
}

.rating-picker label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    color: #334155;
}

.rating-picker input {
    position: absolute;
    opacity: 0;
}

.rating-picker label:has(input:checked) {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

.review-card {
    padding: 16px 0;
    border-top: 1px solid #e2e8f0;
}

.review-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.review-date {
    margin-left: auto;
    color: #94a3b8;
    font-size: 12px;
}

.review-card p {
    margin-top: 8px;
    color: #475569;
    font-size: 14px;
}

.review-book {
    display: inline-block;
    margin-top: 6px;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
}

.muted {
    color: #64748b;
    font-size: 14px;
}

.auth-extra {
    margin: -6px 0 16px;
    text-align: right;
    font-size: 13px;
}

.auth-extra a {
    color: #2563eb;
    font-weight: 600;
}

.current-image {
    width: 140px;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 10px;
}

.delete-card {
    max-width: 560px;
}

.delete-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.delete-actions .btn-primary,
.delete-actions .btn-outline,
.delete-actions .btn-danger {
    flex: 1;
}

@media (max-width: 600px) {
    .status-switch,
    .owner-actions,
    .delete-actions {
        flex-direction: column;
    }

    .catalog-search {
        flex-wrap: wrap;
    }

    .catalog-search select,
    .catalog-search button {
        width: 100%;
        height: 46px;
    }
}

