/* =============================================================
   CLEVMIND CLASSIFIEDS — Frontend & Admin CSS
   Covers: Ad grid, single ad, chat box, forms, dashboard
   ============================================================= */

/* ---- RESET & BASE ------------------------------------------ */
.clmnd-wrap * { box-sizing: border-box; }
.clmnd-wrap { max-width: 1200px; margin: 20px auto; padding: 0 15px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* ---- BUTTONS ----------------------------------------------- */
.clmnd-btn {
    display: inline-block; padding: 10px 20px; border-radius: 6px;
    border: 1px solid #ddd; background: #f5f5f5; color: #333;
    text-decoration: none; cursor: pointer; font-size: 14px;
    font-weight: 600; transition: all 0.2s; line-height: 1;
}
.clmnd-btn:hover { background: #e5e5e5; color: #000; text-decoration: none; }
.clmnd-btn-primary { background: #2c3e50; color: #fff; border-color: #2c3e50; }
.clmnd-btn-primary:hover { background: #1a252f; color: #fff; }
.clmnd-btn-secondary { background: #ecf0f1; color: #2c3e50; border-color: #bdc3c7; }
.clmnd-btn-lg { padding: 14px 28px; font-size: 16px; }
.clmnd-btn-sm { padding: 5px 12px; font-size: 12px; }
.clmnd-btn-full { width: 100%; text-align: center; margin-top: 10px; }

/* ---- NOTICES ----------------------------------------------- */
.clmnd-notice { padding: 15px 20px; border-radius: 6px; margin-bottom: 20px; }
.clmnd-notice-warning { background: #fff8e6; border-left: 4px solid #f39c12; color: #7d5a00; }
.clmnd-notice-error   { background: #fdf0f0; border-left: 4px solid #e74c3c; color: #c00; }
.clmnd-notice-success { background: #f0fdf4; border-left: 4px solid #27ae60; color: #145a32; }
.clmnd-notice-info    { background: #eaf4fe; border-left: 4px solid #2980b9; color: #1a5276; }

/* ---- BADGES ------------------------------------------------ */
.clmnd-badge {
    display: inline-block; padding: 3px 10px; background: #2c3e50;
    color: #fff; border-radius: 20px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px;
}
.clmnd-badge-count {
    display: inline-block; min-width: 18px; height: 18px;
    background: #e74c3c; color: #fff; border-radius: 50%;
    font-size: 11px; font-weight: bold; text-align: center;
    line-height: 18px; padding: 0 4px;
}

/* ---- SEARCH BAR -------------------------------------------- */
.clmnd-search-bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    background: #f9f9f9; padding: 15px; border-radius: 8px;
    margin-bottom: 25px; border: 1px solid #e0e0e0;
}
.clmnd-search-input { flex: 1; min-width: 200px; padding: 10px 15px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.clmnd-cat-select   { padding: 10px 15px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; min-width: 180px; }
.clmnd-results-count { color: #666; font-size: 14px; margin-bottom: 15px; }

/* ---- AD GRID ----------------------------------------------- */
.clmnd-ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px; margin-bottom: 30px;
}

.clmnd-ad-card {
    background: #fff; border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    overflow: hidden; transition: transform 0.2s, box-shadow 0.2s;
}
.clmnd-ad-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.clmnd-card-link { text-decoration: none; color: inherit; display: block; }

.clmnd-card-image { position: relative; height: 190px; overflow: hidden; background: #f0f0f0; }
.clmnd-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.clmnd-ad-card:hover .clmnd-card-image img { transform: scale(1.04); }
.clmnd-no-image { display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 14px; }

.clmnd-card-body { padding: 14px; }
.clmnd-card-title { font-size: 15px; font-weight: 700; margin: 5px 0 8px; color: #1a1a1a; line-height: 1.3; }
.clmnd-card-excerpt { font-size: 13px; color: #666; margin: 0 0 10px; line-height: 1.5; }
.clmnd-card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.clmnd-price { font-size: 17px; font-weight: 800; color: #27ae60; }
.clmnd-location { font-size: 12px; color: #888; }
.clmnd-card-footer { display: flex; justify-content: space-between; font-size: 11px; color: #aaa; border-top: 1px solid #f0f0f0; padding-top: 8px; }
.clmnd-condition { background: #f0f0f0; padding: 2px 8px; border-radius: 10px; }

/* ---- PAGINATION -------------------------------------------- */
.clmnd-pagination { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.clmnd-page-btn { display: inline-block; width: 36px; height: 36px; line-height: 36px; text-align: center; border-radius: 6px; border: 1px solid #ddd; background: #fff; color: #333; font-weight: 600; text-decoration: none; }
.clmnd-page-btn.active { background: #2c3e50; color: #fff; border-color: #2c3e50; }
.clmnd-page-btn:hover { background: #2c3e50; color: #fff; }

/* ---- EMPTY STATE ------------------------------------------- */
.clmnd-empty-state { text-align: center; padding: 60px 20px; color: #666; }
.clmnd-empty-state p { font-size: 18px; margin-bottom: 20px; }

/* ---- SINGLE AD LAYOUT -------------------------------------- */
.clmnd-single-layout { display: grid; grid-template-columns: 1fr 360px; gap: 30px; }
@media (max-width: 900px) { .clmnd-single-layout { grid-template-columns: 1fr; } }

.clmnd-breadcrumb { font-size: 13px; color: #888; margin-bottom: 20px; }
.clmnd-breadcrumb a { color: #2c3e50; text-decoration: none; }
.clmnd-breadcrumb a:hover { text-decoration: underline; }

/* Gallery */
.clmnd-gallery { margin-bottom: 25px; }
.clmnd-gallery-main { border-radius: 10px; overflow: hidden; max-height: 420px; }
.clmnd-gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.clmnd-gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.clmnd-thumb { width: 80px; height: 70px; border-radius: 6px; overflow: hidden; cursor: pointer; border: 2px solid transparent; }
.clmnd-thumb:hover { border-color: #2c3e50; }
.clmnd-thumb img { width: 100%; height: 100%; object-fit: cover; }
.clmnd-no-image-large { height: 300px; background: #f5f5f5; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: 18px; }

/* Ad headline */
.clmnd-ad-headline { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 15px; flex-wrap: wrap; }
.clmnd-ad-title { font-size: 24px; font-weight: 800; color: #1a1a1a; margin: 0; flex: 1; }
.clmnd-ad-price { font-size: 26px; font-weight: 900; color: #27ae60; white-space: nowrap; }

/* Meta bar */
.clmnd-ad-meta-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding: 12px 0; border-top: 1px solid #eee; border-bottom: 1px solid #eee; }
.clmnd-meta-item { font-size: 13px; color: #666; }

/* Description */
.clmnd-ad-description h3 { font-size: 18px; border-bottom: 2px solid #eee; padding-bottom: 8px; }
.clmnd-desc-body { line-height: 1.8; color: #444; font-size: 15px; }

/* ---- SIDEBAR ----------------------------------------------- */
.clmnd-single-sidebar { position: sticky; top: 20px; align-self: start; }

/* Seller card */
.clmnd-seller-card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,.08); margin-bottom: 20px; }
.clmnd-seller-card h3 { margin: 0 0 15px; font-size: 16px; color: #1a1a1a; }
.clmnd-seller-info { display: flex; gap: 12px; align-items: center; margin-bottom: 15px; }
.clmnd-seller-info img { border-radius: 50%; }
.clmnd-seller-info strong { font-size: 15px; }

/* Safety tip */
.clmnd-safety-tip { background: #fffbf0; border: 1px solid #fde8a0; border-radius: 10px; padding: 15px 20px; margin-top: 20px; font-size: 13px; }
.clmnd-safety-tip h4 { margin: 0 0 10px; color: #7d5a00; }
.clmnd-safety-tip ul { margin: 0; padding-left: 18px; color: #7d5a00; }
.clmnd-safety-tip li { margin-bottom: 5px; }

/* ---- CHAT BOX --------------------------------------------- */
.clmnd-chat-box {
    background: #fff; border-radius: 10px; overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.08); margin-bottom: 20px;
}
.clmnd-chat-header {
    background: #2c3e50; color: #fff; padding: 14px 18px;
    display: flex; justify-content: space-between; align-items: center;
}
.clmnd-chat-header h3 { margin: 0; font-size: 15px; }

/* Online indicator dot */
.clmnd-online-indicator {
    width: 10px; height: 10px; border-radius: 50%;
    background: #95a5a6; /* grey = unknown */ transition: background 0.3s;
}
.clmnd-online-indicator.online  { background: #2ecc71; } /* green = online */
.clmnd-online-indicator.offline { background: #95a5a6; } /* grey  = offline */

/* Messages area */
.clmnd-messages {
    height: 320px; overflow-y: auto; padding: 15px;
    display: flex; flex-direction: column; gap: 10px;
    background: #f8f9fa;
}
.clmnd-messages-loading { color: #aaa; text-align: center; padding: 20px; font-size: 13px; }

/* Individual message bubbles */
.clmnd-message { display: flex; gap: 8px; align-items: flex-end; max-width: 90%; }
.clmnd-message.mine  { align-self: flex-end; flex-direction: row-reverse; }
.clmnd-message.theirs { align-self: flex-start; }

.clmnd-message-avatar img { border-radius: 50%; width: 30px; height: 30px; }

.clmnd-message-bubble {
    padding: 10px 14px; border-radius: 18px; font-size: 14px;
    max-width: 220px; line-height: 1.5; word-break: break-word;
}
.clmnd-message.mine   .clmnd-message-bubble { background: #2c3e50; color: #fff; border-bottom-right-radius: 4px; }
.clmnd-message.theirs .clmnd-message-bubble { background: #fff; color: #333; border: 1px solid #e0e0e0; border-bottom-left-radius: 4px; }
.clmnd-message-time { font-size: 10px; color: #aaa; margin-top: 3px; text-align: right; }

/* Chat input */
.clmnd-chat-input-area { display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid #eee; }
.clmnd-chat-input-area textarea {
    flex: 1; border: 1px solid #ddd; border-radius: 8px;
    padding: 8px 12px; font-size: 14px; resize: none; font-family: inherit;
    transition: border-color 0.2s;
}
.clmnd-chat-input-area textarea:focus { outline: none; border-color: #2c3e50; }
.clmnd-chat-hint { font-size: 11px; color: #aaa; text-align: center; padding: 5px 12px 10px; }
.clmnd-chat-login { padding: 30px; text-align: center; color: #666; }

/* ---- POST AD FORM ------------------------------------------ */
.clmnd-form-wrap { background: #fff; padding: 35px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.08); max-width: 720px; margin: 0 auto; }
.clmnd-form-wrap h2 { margin-top: 0; color: #1a1a1a; font-size: 24px; }
.clmnd-form-subtitle { color: #666; margin-bottom: 30px; font-size: 15px; }

.clmnd-field { margin-bottom: 22px; }
.clmnd-field label { display: block; font-weight: 600; margin-bottom: 7px; color: #2c3e50; font-size: 14px; }
.clmnd-required { color: #e74c3c; }
.clmnd-field input[type="text"],
.clmnd-field input[type="tel"],
.clmnd-field input[type="number"],
.clmnd-field select,
.clmnd-field textarea {
    width: 100%; padding: 11px 14px; border: 1px solid #ddd;
    border-radius: 7px; font-size: 14px; font-family: inherit;
    transition: border-color 0.2s; background: #fafafa;
}
.clmnd-field input:focus,
.clmnd-field select:focus,
.clmnd-field textarea:focus { outline: none; border-color: #2c3e50; background: #fff; }
.clmnd-hint { font-size: 12px; color: #999; margin-top: 5px; display: block; }

.clmnd-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 600px) { .clmnd-field-row { grid-template-columns: 1fr; } }

/* ---- USER DASHBOARD --------------------------------------- */
.clmnd-dashboard-header { margin-bottom: 20px; }
.clmnd-dashboard-header h2 { margin: 0; font-size: 22px; color: #1a1a1a; }

.clmnd-tabs { display: flex; gap: 5px; border-bottom: 2px solid #eee; margin-bottom: 25px; }
.clmnd-tab { padding: 10px 20px; text-decoration: none; color: #666; font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.clmnd-tab:hover  { color: #2c3e50; }
.clmnd-tab.active { color: #2c3e50; border-bottom-color: #2c3e50; }

.clmnd-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.clmnd-table th { background: #f5f5f5; padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid #e0e0e0; }
.clmnd-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.clmnd-table tr:hover td { background: #fafafa; }

/* Conversations */
.clmnd-conversations { border: 1px solid #eee; border-radius: 10px; overflow: hidden; }
.clmnd-conversation-item { display: flex; gap: 12px; align-items: center; padding: 15px 18px; text-decoration: none; color: inherit; border-bottom: 1px solid #f0f0f0; transition: background 0.15s; }
.clmnd-conversation-item:last-child { border-bottom: none; }
.clmnd-conversation-item:hover { background: #f8f9fa; }
.clmnd-conversation-item.unread { background: #f0f7ff; }
.clmnd-conv-avatar { position: relative; flex-shrink: 0; }
.clmnd-conv-avatar img { border-radius: 50%; }
.clmnd-conv-details { flex: 1; min-width: 0; }
.clmnd-conv-details strong { display: block; font-size: 15px; color: #1a1a1a; }
.clmnd-conv-ad { font-size: 12px; color: #888; display: block; margin: 2px 0; }
.clmnd-conv-preview { font-size: 13px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.clmnd-conv-time { font-size: 11px; color: #aaa; flex-shrink: 0; }

/* ---- RESPONSIVE ------------------------------------------- */
@media (max-width: 600px) {
    .clmnd-ads-grid { grid-template-columns: 1fr 1fr; }
    .clmnd-ad-title { font-size: 20px; }
    .clmnd-form-wrap { padding: 20px; }
}
@media (max-width: 400px) {
    .clmnd-ads-grid { grid-template-columns: 1fr; }
}

/* =============================================================
   ADDITIONS: Lightbox, improved chat, quick replies, online status
   ============================================================= */

/* ---- LIGHTBOX ---------------------------------------------- */
#clmnd-lightbox {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 99999; display: flex; align-items: center; justify-content: center;
}
#clmnd-lightbox-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,.92); cursor: pointer;
}
#clmnd-lightbox-content {
    position: relative; z-index: 1; display: flex; align-items: center;
    justify-content: center; gap: 15px; padding: 20px; max-width: 95vw;
}
#clmnd-lightbox-img {
    max-width: 80vw; max-height: 85vh; object-fit: contain;
    border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5);
    display: block;
}
#clmnd-lightbox-close {
    position: fixed; top: 18px; right: 22px; background: rgba(255,255,255,.15);
    border: none; color: #fff; font-size: 22px; width: 44px; height: 44px;
    border-radius: 50%; cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: background 0.2s; z-index: 2;
}
#clmnd-lightbox-close:hover { background: rgba(255,255,255,.3); }

#clmnd-lightbox-prev,
#clmnd-lightbox-next {
    background: rgba(255,255,255,.15); border: none; color: #fff;
    font-size: 24px; width: 50px; height: 50px; border-radius: 50%;
    cursor: pointer; transition: background 0.2s; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
#clmnd-lightbox-prev:hover,
#clmnd-lightbox-next:hover { background: rgba(255,255,255,.3); }

#clmnd-lightbox-counter {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    color: #fff; background: rgba(0,0,0,.5); padding: 5px 15px;
    border-radius: 20px; font-size: 13px;
}

/* Prevent body scroll when lightbox is open */
body.clmnd-lightbox-open { overflow: hidden; }

/* Main image cursor + zoom hint */
#clmnd-main-img { cursor: zoom-in; width: 100%; display: block; }
.clmnd-zoom-hint {
    text-align: center; font-size: 12px; color: #aaa;
    margin-top: 6px; pointer-events: none;
}

/* Active thumbnail highlight */
.clmnd-thumb.active { border-color: #2c3e50 !important; }
.clmnd-thumb { cursor: pointer; transition: border-color 0.2s; }

/* ---- CHAT — IMPROVED -------------------------------------- */
.clmnd-chat-box { border-radius: 12px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,.12); }

.clmnd-chat-header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #fff; padding: 12px 15px;
    display: flex; justify-content: space-between; align-items: center;
}
.clmnd-chat-avatar { border-radius: 50%; border: 2px solid rgba(255,255,255,.3); }

/* Messages area */
.clmnd-messages {
    height: 340px; overflow-y: auto; padding: 15px;
    display: flex; flex-direction: column; gap: 12px;
    background: #f0f2f5; scroll-behavior: smooth;
}

/* Empty state inside chat */
.clmnd-chat-empty { text-align: center; padding: 30px 15px; color: #aaa; }
.clmnd-chat-empty p { margin: 4px 0; }

/* Message bubbles */
.clmnd-message { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.clmnd-message.mine   { align-self: flex-end; flex-direction: row-reverse; }
.clmnd-message.theirs { align-self: flex-start; }
.clmnd-message-body   { display: flex; flex-direction: column; }
.clmnd-message.mine   .clmnd-message-body { align-items: flex-end; }
.clmnd-message.theirs .clmnd-message-body { align-items: flex-start; }

.clmnd-message-bubble {
    padding: 10px 14px; border-radius: 18px; font-size: 14px;
    max-width: 220px; line-height: 1.5; word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.clmnd-message.mine   .clmnd-message-bubble {
    background: #2c3e50; color: #fff;
    border-bottom-right-radius: 4px;
}
.clmnd-message.theirs .clmnd-message-bubble {
    background: #fff; color: #333;
    border-bottom-left-radius: 4px;
    border: 1px solid #e8e8e8;
}
.clmnd-message-time { font-size: 10px; color: #aaa; margin-top: 4px; padding: 0 4px; }

/* Avatar initials fallback */
.clmnd-avatar-initials {
    width: 30px; height: 30px; border-radius: 50%;
    background: #7f8c8d; color: #fff; display: flex;
    align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
}

/* Failed message */
.clmnd-msg-failed .clmnd-message-bubble { opacity: 0.6; }

/* Typing indicator (animated dots) */
.clmnd-typing-indicator {
    align-self: flex-start; background: #fff; border-radius: 18px;
    padding: 12px 16px; display: flex; gap: 4px; align-items: center;
    border: 1px solid #e8e8e8; box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.clmnd-typing-indicator span {
    width: 7px; height: 7px; border-radius: 50%; background: #aaa;
    display: inline-block; animation: clmnd-bounce 1.2s infinite;
}
.clmnd-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.clmnd-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes clmnd-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-6px); }
}

/* Quick reply chips */
.clmnd-quick-replies {
    display: flex; gap: 7px; flex-wrap: wrap;
    padding: 10px 12px 4px; background: #f0f2f5; border-top: 1px solid #e5e5e5;
}
.clmnd-chip {
    background: #fff; border: 1px solid #2c3e50; color: #2c3e50;
    border-radius: 20px; padding: 5px 13px; font-size: 12px;
    cursor: pointer; transition: all 0.15s; font-weight: 600;
    white-space: nowrap;
}
.clmnd-chip:hover { background: #2c3e50; color: #fff; }

/* Chat input */
.clmnd-chat-input-area {
    display: flex; gap: 8px; padding: 10px 12px;
    background: #fff; border-top: 1px solid #eee; align-items: flex-end;
}
.clmnd-chat-input-area textarea {
    flex: 1; border: 1px solid #ddd; border-radius: 20px;
    padding: 9px 14px; font-size: 14px; resize: none; font-family: inherit;
    transition: border-color 0.2s; line-height: 1.5; max-height: 100px;
}
.clmnd-chat-input-area textarea:focus { outline: none; border-color: #2c3e50; }
#clmnd-send-btn { border-radius: 50%; width: 40px; height: 40px; padding: 0; font-size: 16px; flex-shrink: 0; }

.clmnd-chat-hint { font-size: 11px; color: #aaa; text-align: center; padding: 5px 0 8px; }
.clmnd-chat-login { padding: 25px; text-align: center; color: #666; background: #fafafa; }

/* ---- SELLER INBOX (on own ad view) ----------------------- */
.clmnd-seller-inbox { max-height: 280px; overflow-y: auto; }
.clmnd-inbox-item {
    display: flex; gap: 10px; align-items: center; padding: 12px 15px;
    text-decoration: none; color: inherit; border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}
.clmnd-inbox-item:hover { background: #f8f9fa; }
.clmnd-inbox-avatar { position: relative; flex-shrink: 0; }
.clmnd-inbox-avatar .clmnd-badge-count { position: absolute; top: -4px; right: -4px; }
.clmnd-inbox-details { flex: 1; min-width: 0; }
.clmnd-inbox-details strong { display: block; font-size: 14px; color: #1a1a1a; }
.clmnd-inbox-details span { font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.clmnd-inbox-time { font-size: 11px; color: #aaa; flex-shrink: 0; }

/* Mobile: lightbox full screen */
@media (max-width: 600px) {
    #clmnd-lightbox-img { max-width: 95vw; }
    #clmnd-lightbox-prev,
    #clmnd-lightbox-next { width: 38px; height: 38px; font-size: 18px; }
}

/* =============================================================
   SELLER TWO-PANEL CHAT
   ============================================================= */

/* Buyer list items in seller view */
.clmnd-buyer-item {
    display: flex; gap: 10px; align-items: center;
    padding: 13px 15px; cursor: pointer;
    border-bottom: 1px solid #f0f0f0; transition: background 0.15s;
}
.clmnd-buyer-item:hover        { background: #f0f4ff; }
.clmnd-buyer-item-active       { background: #e8f0fe !important; border-left: 3px solid #2c3e50; }

.clmnd-inbox-avatar            { position: relative; flex-shrink: 0; }
.clmnd-inbox-details           { flex: 1; min-width: 0; }
.clmnd-inbox-details strong    { display: block; font-size: 14px; color: #1a1a1a; }
.clmnd-inbox-details span      { font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; margin-top: 2px; }
.clmnd-inbox-time              { font-size: 11px; color: #aaa; flex-shrink: 0; }

/* Back button in chat header */
.clmnd-btn-ghost {
    background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
    color: #fff; padding: 5px 12px; border-radius: 6px; cursor: pointer;
    font-size: 12px; transition: background 0.2s;
}
.clmnd-btn-ghost:hover { background: rgba(255,255,255,.25); }

/* Buyer list scroll area */
#clmnd-buyer-list {
    max-height: 340px; overflow-y: auto;
}

/* Conversation panel messages height same as buyer chat */
#clmnd-conversation-panel .clmnd-messages {
    height: 280px;
}

/* =============================================================
   GOOGLE LOGIN BUTTON
   ============================================================= */

.clmnd-google-login-wrap {
    margin: 20px 0 10px;
    text-align: center;
}

/* The Google button itself */
.clmnd-google-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    max-width: 320px;
    padding: 12px 20px;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.clmnd-google-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
    color: #3c4043;
    text-decoration: none;
}
.clmnd-google-btn:active {
    background: #f1f3f4;
}
.clmnd-google-btn svg {
    flex-shrink: 0;
}

/* Divider between Google button and standard form */
.clmnd-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px auto;
    max-width: 320px;
    color: #aaa;
    font-size: 13px;
}
.clmnd-divider::before,
.clmnd-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

/* Error message below button */
.clmnd-google-error {
    background: #fff0f0;
    border: 1px solid #fcc;
    border-radius: 6px;
    padding: 10px 15px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #c00;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

/* On WordPress default login page — centre the button */
body.login .clmnd-google-login-wrap {
    margin: 0 0 20px;
}
body.login .clmnd-google-btn {
    max-width: 100%;
}

/* =============================================================
   LOGIN BUTTON — Fixed top-right corner
   ============================================================= */

#clmnd-login-trigger-wrap {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 9000;  /* above most theme elements */
}

/* Sign In button (logged out state) */
.clmnd-login-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: #2c3e50;
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 12px rgba(44,62,80,.35);
    transition: all 0.2s;
    letter-spacing: 0.2px;
}
.clmnd-login-trigger-btn:hover {
    background: #1a252f;
    box-shadow: 0 4px 16px rgba(44,62,80,.45);
    transform: translateY(-1px);
}
.clmnd-login-trigger-btn svg {
    flex-shrink: 0;
}

/* =============================================================
   USER MENU — Avatar + Dropdown (logged in state)
   ============================================================= */

.clmnd-user-menu {
    position: relative;
}

.clmnd-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px 5px 5px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    transition: all 0.2s;
}
.clmnd-user-btn:hover,
.clmnd-user-btn.open {
    box-shadow: 0 3px 12px rgba(0,0,0,.15);
    border-color: #c0c0c0;
}
.clmnd-user-btn img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}
.clmnd-user-btn span {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.clmnd-user-btn svg {
    opacity: 0.5;
    transition: transform 0.2s;
}
.clmnd-user-btn.open svg {
    transform: rotate(180deg);
}

/* Dropdown panel */
.clmnd-user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,.15);
    border: 1px solid #f0f0f0;
    overflow: hidden;
    z-index: 9001;
}

/* Dropdown header — avatar + name + email */
.clmnd-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}
.clmnd-dropdown-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.clmnd-dropdown-header strong {
    display: block;
    font-size: 14px;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.clmnd-dropdown-header span {
    display: block;
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* Dropdown links */
.clmnd-dropdown-links {
    padding: 6px 0;
}
.clmnd-dropdown-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    transition: background 0.12s;
    position: relative;
}
.clmnd-dropdown-links a:hover {
    background: #f5f7ff;
    color: #2c3e50;
}
.clmnd-dropdown-links .clmnd-badge-count {
    margin-left: auto;
}
.clmnd-dropdown-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 4px 0;
}
.clmnd-logout-link {
    color: #e74c3c !important;
}
.clmnd-logout-link:hover {
    background: #fff5f5 !important;
}

/* =============================================================
   LOGIN MODAL POPUP
   ============================================================= */

.clmnd-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Dark dimmed backdrop */
.clmnd-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 30, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Prevent body scroll when modal is open */
body.clmnd-modal-open {
    overflow: hidden;
}

/* The white card */
.clmnd-modal-card {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 24px;
    padding: 40px 36px 30px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 60px rgba(0,0,0,.25);
    text-align: center;
    animation: clmnd-modal-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes clmnd-modal-in {
    from { opacity: 0; transform: translateY(24px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Close X button */
.clmnd-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.clmnd-modal-close:hover {
    background: #eee;
    color: #333;
    transform: rotate(90deg);
}

/* Branding section */
.clmnd-modal-brand {
    margin-bottom: 28px;
}
.clmnd-modal-logo {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,.1));
}
.clmnd-modal-brand h2 {
    font-size: 22px;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0 0 4px;
}
.clmnd-modal-brand p {
    font-size: 14px;
    color: #888;
    margin: 0;
}

/* Subtitle */
.clmnd-modal-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0 0 20px;
    line-height: 1.5;
}

/* The Google Sign In button — large, beautiful */
.clmnd-google-signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    width: 100%;
    padding: 14px 20px;
    background: #fff;
    color: #3c4043;
    border: 1.5px solid #dadce0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    margin-bottom: 16px;
}
.clmnd-google-signin-btn:hover {
    background: #f8f9fa;
    border-color: #bdc1c6;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    color: #3c4043;
    text-decoration: none;
    transform: translateY(-1px);
}
.clmnd-google-signin-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.clmnd-google-icon {
    flex-shrink: 0;
}

/* Terms text */
.clmnd-modal-terms {
    font-size: 12px;
    color: #aaa;
    line-height: 1.6;
    margin: 0;
}
.clmnd-modal-terms strong {
    color: #888;
}

/* Error box inside modal */
.clmnd-modal-error {
    background: #fff0f0;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 13px;
    color: #c00;
    text-align: left;
}

/* Modal footer */
.clmnd-modal-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    font-size: 11px;
    color: #ccc;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .clmnd-modal-card {
        padding: 32px 24px 24px;
        border-radius: 20px;
    }
    .clmnd-user-btn span {
        display: none; /* hide name on small screens, show only avatar */
    }
    #clmnd-login-trigger-wrap {
        top: 12px;
        right: 12px;
    }
}

/* =============================================================
   FIX 1: HIDE WORDPRESS ADMIN BAR for non-admins
   FIX 4: Hide default WP toolbar (Howdy, W icon etc)
   ============================================================= */

/* Hide the WP admin bar completely for subscribers/logged-in non-admins */
.logged-in #wpadminbar { display: none !important; }

/* Also remove the body margin WordPress adds for the admin bar */
.logged-in.admin-bar html,
.logged-in.admin-bar body { margin-top: 0 !important; padding-top: 0 !important; }

/* Hide for ALL users on frontend — only show admin bar when in wp-admin */
body.logged-in #wpadminbar { display: none !important; }
html { margin-top: 0 !important; }


/* =============================================================
   FIX 1 + CUSTOM NAV BAR
   Replaces the basic Twenty Twenty-Five theme nav with a clean
   modern sticky header
   ============================================================= */

#clmnd-navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 62px;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,.08);
    z-index: 8999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

/* Push page content down so it's not hidden under navbar */
body { padding-top: 62px !important; }

/* Logo / site name left side */
#clmnd-navbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #1a1a1a;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}
#clmnd-navbar-logo .clmnd-nav-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #2c3e50, #3d5a74);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(44,62,80,.3);
}
#clmnd-navbar-logo:hover { text-decoration: none; color: #2c3e50; }

/* Nav links — centre */
#clmnd-navbar-links {
    display: flex;
    align-items: center;
    gap: 6px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
#clmnd-navbar-links a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #444;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
#clmnd-navbar-links a:hover {
    background: #f0f4ff;
    color: #2c3e50;
    text-decoration: none;
}
#clmnd-navbar-links a.active {
    background: #eef2ff;
    color: #2c3e50;
}

/* Post Ad button in nav — stands out */
#clmnd-navbar-links .clmnd-nav-post-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
}
#clmnd-navbar-links .clmnd-nav-post-btn:hover {
    background: linear-gradient(135deg, #1e8449, #27ae60);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(39,174,96,.3);
}

/* Hamburger for mobile */
#clmnd-nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #333;
}

/* Mobile nav drawer */
#clmnd-nav-mobile {
    display: none;
    position: fixed;
    top: 62px; left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 12px 20px;
    z-index: 8998;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 20px rgba(0,0,0,.1);
}
#clmnd-nav-mobile a {
    display: block;
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
}
#clmnd-nav-mobile a:hover { background: #f5f5f5; }
#clmnd-nav-mobile.open { display: flex; }

/* Hide theme's own header/nav so we don't have double navigation */
.site-header,
header.wp-block-template-part,
.wp-block-site-title,
.wp-block-navigation,
.wp-site-blocks > header { 
    display: none !important; 
}


/* =============================================================
   FIX 2: VIBRANT MODERN SIGN IN BUTTON
   ============================================================= */

/* Override the fixed position — now inside our navbar */
#clmnd-login-trigger-wrap {
    position: static !important;
    top: auto !important;
    right: auto !important;
    flex-shrink: 0;
}

/* New vibrant gradient Sign In button */
.clmnd-login-trigger-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 9px 20px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 50px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    font-family: inherit !important;
    box-shadow: 0 4px 15px rgba(102,126,234,.45) !important;
    transition: all 0.2s !important;
    letter-spacing: 0.3px !important;
    white-space: nowrap !important;
}
.clmnd-login-trigger-btn:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4292 100%) !important;
    box-shadow: 0 6px 20px rgba(102,126,234,.55) !important;
    transform: translateY(-2px) !important;
}


/* =============================================================
   FIX 3: CENTER Google button properly in popup
   ============================================================= */

.clmnd-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;      /* horizontal center */
    width: 100%;
}

.clmnd-modal-subtitle {
    text-align: center;
    width: 100%;
}

.clmnd-google-signin-btn {
    width: 100% !important;
    max-width: 320px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-content: center !important;
}

.clmnd-modal-terms {
    text-align: center;
    width: 100%;
    max-width: 300px;
}


/* =============================================================
   MOBILE RESPONSIVE NAVBAR
   ============================================================= */

@media (max-width: 768px) {
    #clmnd-navbar-links { display: none; }
    #clmnd-nav-hamburger { display: block; }
    #clmnd-navbar { padding: 0 16px; }
    body { padding-top: 62px !important; }
}

@media (max-width: 480px) {
    .clmnd-user-btn span { display: none; }
    .clmnd-login-trigger-btn { padding: 8px 14px !important; font-size: 13px !important; }
}
