/* ==========================================================================
   1. RESET & BASE STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #ffffff;
    color: #111111;
    font-size: 14px;
    line-height: 1.4;
}

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

/* ==========================================================================
   2. HEADER, NAVIGATION & FILTERS
   ========================================================================== */
.top-header {
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #cccccc;
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 10px 20px;
}

.header-content,
.header-top-row {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand-logo {
    font-size: 1.5rem;
    font-weight: 900;
    color: #ff522b;
    letter-spacing: -0.5px;
}

/* Search Field */
.search-form {
    flex: 1;
    max-width: 480px;
}

.search-input {
    width: 100%;
    height: 34px;
    border: 1px solid #777777;
    padding: 0 12px;
    font-size: 0.9rem;
    color: #333333;
}

.search-input::placeholder {
    color: #888888;
    font-style: italic;
}

/* Header Icons & Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.post-link {
    color: #ff522b;
    font-weight: 700;
    font-size: 0.9rem;
}

.icon-link {
    font-size: 1.3rem;
    color: #111111;
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.icon-link .badge {
    font-size: 0.85rem;
    font-weight: 700;
}

.unread-dot {
    width: 8px;
    height: 8px;
    background-color: #ff522b;
    border-radius: 50%;
    position: absolute;
    top: -2px;
    right: -4px;
}

/* Sub-header & Filters */
.sub-header {
    max-width: 1200px;
    margin: 5px auto 0 auto;
    padding: 5px 20px 10px 20px;
}

.filter-controls {
    display: flex;
    gap: 20px;
}

.filter-btn {
    background: none;
    border: none;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    color: #111111;
    padding: 0;
    margin-right: 15px;
}

/* Dropdown Filter Panel */
.filter-dropdown-panel {
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    padding: 20px;
}

.filter-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.filter-group strong {
    margin-bottom: 6px;
}

.filter-group label {
    margin-bottom: 4px;
    cursor: pointer;
}

.btn-done {
    border: 1px solid #000;
    background: white;
    padding: 6px 18px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
}

/* ==========================================================================
   3. COMMON UTILITIES & FLASH MESSAGES
   ========================================================================== */
.page-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px 40px 20px;
}

.flash-wrapper {
    margin-bottom: 15px;
}

.flash-banner {
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.flash-success { background-color: #e8f5e9; color: #2e7d32; }
.flash-error   { background-color: #ffebee; color: #c62828; }

.status-available {
    color: #2e7d32;
    font-weight: 700;
}

/* ==========================================================================
   4. MARKETPLACE GRID & ITEM CARDS
   ========================================================================== */


/* ==========================================================================
   4. MARKETPLACE GRID & ITEM CARDS
   ========================================================================== */
.market-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 850px) {
    .market-grid {
        grid-template-columns: 1fr;
    }
}

.item-card {
    background-color: #ededed;
    display: flex;
    align-items: flex-start; /* Stops the image column from stretching to match the text height */
    padding: 15px;
    gap: 15px;
    border-radius: 2px;
}

.card-image-wrapper {
    width: 180px;
    height: 180px;
    flex-shrink: 0;
    background-color: #cccccc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Prevents overflow */
    position: relative;
}

.card-image-wrapper a {
    display: block;
    width: 100%;
    height: 100%;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Auto-crops top/bottom of portrait photos cleanly */
    object-position: center; /* Keeps the center of the artwork in view */
    display: block;
}

.placeholder-img {
    font-size: 3rem;
    color: #888888;
}

.card-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    min-height: 180px; /* Keeps the metadata column matching the image height */
}



.item-title {
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 6px;
    color: #000000;
}

.item-spec {
    font-size: 0.85rem;
    color: #333333;
    margin-bottom: 2px;
}

.status-spec {
    margin-bottom: 8px;
}

.item-user-caption {
    font-size: 0.82rem;
    color: #222222;
    line-height: 1.35;
    margin-bottom: 10px;
}

.username-link {
    color: #000000;
}

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

.card-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
}

.action-link {
    background: none;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #333333;
    cursor: pointer;
    padding: 0;
    width: fit-content;
}

.action-link:hover {
    color: #000000;
}

.like-btn {
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333333;
}

.like-btn:hover,
.like-btn.liked {
    color: #ff522b;
}

/* ==========================================================================
   5. PROFILE PAGE & GRID
   ========================================================================== */
.profile-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

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

.profile-avatar img, 
.avatar-placeholder {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.profile-title-row {
    display: flex;
    align-items: baseline;
    gap: 15px;
}

.user-rating {
    color: #28a745;
    font-weight: bold;
    font-size: 0.9em;
}

.profile-stats {
    display: flex;
    gap: 20px;
    margin: 8px 0;
}

.btn-profile {
    display: inline-block;
    padding: 6px 16px;
    border: 1px solid #000;
    color: #000;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85em;
    background: #fff;
    margin-top: 5px;
}

.profile-divider {
    border: 0;
    border-top: 1px solid #ccc;
    margin: 25px 0;
}

.section-title {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.profile-card {
    background: #f4f4f4;
    border: 1px solid #e0e0e0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
}

.card-header-title {
    font-size: 0.85em;
    margin-bottom: 8px;
    min-height: 36px;
}

.card-subtitle {
    color: #555;
    font-size: 0.9em;
}

.card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #ddd;
    margin-bottom: 8px;
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em;
    font-weight: bold;
}

/* ==========================================================================
   6. FORMS & INPUTS
   ========================================================================== */
.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.field-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #111111;
}

.form-group-row {
    display: flex;
    gap: 15px;
}

.form-group-row > div,
.form-group-row .field {
    flex: 1;
}

.form-container {
    max-width: 600px;
    margin: 30px auto;
    padding: 30px;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.form-title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: #111111;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-container input[type="text"],
.form-container input[type="number"],
.form-container input[type="file"],
.form-container select,
.form-container textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cccccc;
    border-radius: 2px;
    font-size: 0.9rem;
    font-family: inherit;
    background-color: #ffffff;
    color: #111111;
}

.form-container textarea {
    resize: vertical;
    min-height: 90px;
}

.form-container input:focus,
.form-container select:focus,
.form-container textarea:focus {
    outline: none;
    border-color: #ff522b;
}

.form-actions {
    margin-top: 10px;
}

.btn-submit {
    width: 100%;
    background-color: #ff522b;
    color: #ffffff;
    border: none;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    text-transform: uppercase;
    transition: background-color 0.2s ease;
}

.btn-submit:hover {
    background-color: #e04420;
}

/* ==========================================================================
   7. POST DETAIL PAGE
   ========================================================================== */
.post-detail-container {
    max-width: 950px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.post-detail-title {
    font-size: 1.6rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    text-align: left;
}

.post-detail-main {
    display: grid;
    grid-template-columns: minmax(300px, 380px) 1fr;
    gap: 2.5rem;
    align-items: start;
}

.image-slider-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.image-frame {
    width: 350px;
    height: 350px;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
}

.image-frame img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#next-img-btn {
    position: absolute;
    right: -25px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 10px;
    transition: color 0.15s ease;
}

#next-img-btn:hover {
    color: #000;
}

.post-info {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #111;
}

.post-info p {
    margin: 0 0 0.5rem 0;
}

.post-status {
    margin-bottom: 1rem !important;
}

.seller-caption-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}

.seller-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.seller-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.caption-text a {
    color: #000;
    text-decoration: none;
}

.post-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.action-trade-link {
    color: #000;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==========================================================================
   8. TRADES DASHBOARD & TRAY
   ========================================================================== */
.trade-circle {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #e2c044;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selectable-card.selected .trade-circle {
    background-color: #e2c044;
    color: #000;
}

.trade-collection-bg {
    background-color: #e0e0e0;
    padding: 20px;
    border-radius: 8px;
}

.trades-wrapper {
    display: flex;
    gap: 20px;
    max-width: 1100px;
    margin: 30px auto;
}

.trades-sidebar {
    width: 320px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 15px;
}

.trades-tabs {
    display: flex;
    justify-content: space-around;
    border-bottom: 2px solid #eee;
    margin-bottom: 15px;
}

.trades-tabs a {
    padding: 8px 12px;
    text-decoration: none;
    font-size: 14px;
    color: #888;
}

.trades-tabs a.active {
    color: #e76f51;
    border-bottom: 2px solid #e76f51;
    font-weight: bold;
}

.trade-item-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: #333;
}

.trade-item-card.selected {
    background-color: #f9f9f9;
}

.trade-viewer {
    flex: 1;
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.carousel-container {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 340px;
}

.carousel-viewport {
    width: 280px;
    overflow-x: auto;
    display: flex;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.carousel-viewport::-webkit-scrollbar {
    display: none;
}

.carousel-item {
    min-width: 280px;
    scroll-snap-align: start;
    box-sizing: border-box;
}

.card-box {
    border: 1px solid #e0e0e0;
    background: #f5f5f5;
    padding: 12px;
    text-align: center;
}

.card-box img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    margin: 8px 0;
}

.nav-arrow {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}

.nav-arrow:hover {
    color: #333;
}

.trade-actions {
    display: flex;
    gap: 20px;
    margin-top: 25px;
}

.action-btn {
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    border: 1px solid #333;
    color: #333;
}

/* Floating Trade Tray */
.trade-tray {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #ffffff;
    border: 2px solid #333333;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 1000;
}

.trade-summary p {
    margin: 2px 0;
    font-size: 14px;
}

#submit-trade-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}



.trades-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.trade-sidebar-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
    border-bottom: 1px solid #e0e0e0;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

.trade-sidebar-card:hover,
.trade-sidebar-card.selected {
    background-color: #f7f7f7;
}

.card-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    background-color: #eee;
    border-radius: 2px;
    overflow: hidden;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 1.2rem;
}

.card-meta {
    flex: 1;
    min-width: 0; /* Enables text clipping */
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-offers-count {
    font-size: 0.8rem;
    color: #888;
}

.card-chevron {
    font-size: 0.75rem;
    color: #111;
    padding-left: 4px;
}


/* Sidebar Container */
.trades-sidebar {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    padding-top: 10px;
}

/* Tab Bar with 3 Columns & Bottom Accent Bar */
.trade-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.tab-link {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #888;
    text-decoration: none;
    position: relative;
    transition: color 0.2s ease;
}

.tab-link:hover {
    color: #444;
}

.tab-link.active {
    color: #ff5a36; /* Coral orange active state */
    font-weight: 700;
}

.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #ff5a36;
}

/* Search Box Styling */
.trade-search-box {
    position: relative;
    margin: 0 12px 15px 12px;
}

.trade-search-box input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    border: 1.5px solid #111;
    border-radius: 2px;
    font-size: 0.85rem;
    outline: none;
}

.trade-search-box .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 0.85rem;
}


.swap-icon-container {
    text-align: center;
    margin: 15px 0;
}

.swap-icon {
    font-size: 1.6rem;
    color: #ff5a36; /* Coral accent color */
    display: inline-block;
    transition: transform 0.3s ease;
}

.swap-icon:hover {
    transform: rotate(180deg);
}

/* User Header Row in Trade Viewer */
.user-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.user-username {
    font-weight: 700;
    font-size: 0.95rem;
    color: #111;
}

/* Small Profile Avatars */
.user-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-placeholder-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #eee;
    color: #777;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Central Swap Icon */
.swap-icon-container {
    text-align: center;
    margin: 15px 0;
}

.swap-icon {
    font-size: 1.5rem;
    color: #ff5a36;
    display: inline-block;
    transition: transform 0.3s ease;
}

.swap-icon:hover {
    transform: rotate(180deg);
}

.status-available {
    color: #2e7d32; /* Green */
    font-weight: 600;
}

.status-traded {
    color: #777777; /* Gray */
    font-weight: 600;
}

.traded-card {
    opacity: 0.75;
}

.trade-btn.disabled {
    background-color: #e0e0e0;
    color: #888888;
    cursor: not-allowed;
    pointer-events: none;
    text-decoration: none;
}


.form-container input[type="text"],
.form-container input[type="email"],
.form-container input[type="password"],
.form-container input[type="number"],
.form-container input[type="file"],
.form-container select,
.form-container textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cccccc;
    border-radius: 2px;
    font-size: 0.9rem;
    font-family: inherit;
    background-color: #ffffff;
    color: #111111;
}
