/* ================= RESET ================= */

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

body {
    font-family: Arial, sans-serif;
    background: #f6f7f9;
}

/* ================= HEADER ================= */

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.logo {
    font-size: 18px;
    font-weight: bold;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 18px;
}

/* ================= VIEW TAB ================= */

.view-tab {
    position: sticky;
    top: 51px; /* Just below header */
    z-index: 100;
    
    display: flex;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.view-btn, #my-posts-tab button {
    flex: 1;
    padding: 12px;
    border: none;
    background: #eee;
    font-size: 13px;
    cursor: pointer;
}

.view-btn.active, #my-posts-tab button.active {
    background: #ff7b54;
    color: #fff;
    font-weight: bold;
}

/* ================= CONTENT ================= */

#app {
    padding: 12px;
    padding-bottom: 160px;
}

/* ================= VIEW SECTIONS ================= */

.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

/* ================= FULL PAGE VIEWS ================= */

.full-page {
    display: none; /* Initially hidden */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #fff;
    z-index: 1000;
    padding: 24px;
    flex-direction: column;
}

.full-page.active {
    display: flex; /* Show only when active */
}

/* ================= INTRO ================= */

#intro-view {
    justify-content: space-between;
    align-items: center;
    text-align: center;
    background: linear-gradient(to bottom, #fff, #fff5f2);
}

.intro-content {
    margin-top: 30vh;
}

.logo-large {
    font-size: 42px;
    color: #ff7b54;
    font-weight: 900;
    margin-bottom: 12px;
}

.tagline {
    font-size: 16px;
    color: #666;
}

/* ================= FULL PAGE HEADERS ================= */

#my-posts-view,
#privacy-view,
#terms-view {
    padding: 0;
}

#my-posts-view .header-simple,
#privacy-view .header-simple,
#terms-view .header-simple {
    padding: 14px 20px;
    margin-bottom: 0;
    border-bottom: 1px solid #eee;
}

/* ================= SIGNUP ================= */

#signup-view {
    overflow-y: auto;
    padding-bottom: 80px;
}

.header-simple {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 40px;
}

.header-simple h2 {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #222;
}

.header-simple .header-spacer {
    width: 40px;
    flex-shrink: 0;
}

.text-btn.danger {
    color: #ff3b30;
}

.text-btn {
    background: none;
    border: none;
    color: #ff7b54;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

/* ================= DETAIL VIEW ================= */

#detail-view {
    padding: 0;
}

#detail-view .header-simple {
    padding: 14px 20px;
    margin-bottom: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #eee;
}

.detail-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 120px;
}

#detail-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1100;
    display: flex;
    flex-direction: column;
}

.bottom-fixed-action {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: #fff;
    border-top: 1px solid #eee;
    z-index: 1100;
}

#detail-bottom-bar .bottom-fixed-action {
    position: static;
    z-index: auto;
    border-top: none;
}

.bottom-fixed-comment {
    padding: 10px 20px 16px;
    background: #fff;
    border-top: 1px solid #eee;
}

.bottom-fixed-comment .reply-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 8px;
    font-size: 12px;
    color: #ff7b54;
}

.bottom-fixed-comment .cancel-reply-btn {
    background: none;
    border: none;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    text-decoration: underline;
}

.bottom-fixed-comment .comment-input-row {
    display: flex;
    gap: 8px;
}

.bottom-fixed-comment .comment-input-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
}

.bottom-fixed-comment .comment-input-row input:focus {
    outline: none;
    border-color: #ff7b54;
}

.bottom-fixed-comment .comment-submit {
    padding: 10px 16px;
    background: #ff7b54;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.detail-img-grid {
    display: flex;
    flex-wrap: wrap;
    padding: 0 20px;
    margin-bottom: 16px;
}

.detail-img-cell {
    box-sizing: border-box;
    padding: 3px;
}

.detail-main-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

/* ================= FULL IMAGE OVERLAY ================= */

.full-image-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.full-image-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.9);
}

.full-image-view {
    position: relative;
    max-width: 95%;
    max-height: 80vh;
    object-fit: contain;
    z-index: 1;
    transition: opacity 0.2s;
}

.full-image-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    z-index: 2;
}

.full-image-indicators {
    position: relative;
    display: flex;
    gap: 8px;
    margin-top: 16px;
    z-index: 1;
}

.full-image-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    cursor: pointer;
    padding: 0;
}

.full-image-dot.active {
    background: #fff;
}

.full-image-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 20px 10px;
    opacity: 0.7;
}

.full-image-nav:hover { opacity: 1; }
.full-image-nav.prev { left: 10px; }
.full-image-nav.next { right: 10px; }

/* ================= PROFILE ================= */

.profile-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.profile-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #eee;
    object-fit: cover;
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 15px;
    font-weight: bold;
    color: #333;
}

.detail-info {
    padding: 24px 20px;
    text-align: left;
}

.detail-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.detail-category {
    font-size: 14px;
    color: #ff7b54;
    font-weight: bold;
    margin-bottom: 8px;
}

.detail-title {
    font-size: 20px;
    color: #111;
    line-height: 1.4;
    font-weight: bold;
    word-break: break-all;
    overflow-wrap: break-word;
}

.detail-body {
    font-size: 15px;
    color: #444;
    line-height: 1.6;
    text-align: left;
    margin-top: 20px;
    padding-bottom: 20px;
}

.detail-meta-info {
    font-size: 13px;
    color: #999;
    margin-top: 12px;
}

/* ================= LIKES & COMMENTS ================= */

.detail-actions {
    padding: 12px 0;
    border-top: 1px solid #eee;
}

.like-btn {
    background: none;
    border: 1px solid #eee;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 14px;
    cursor: pointer;
    color: #666;
}

.like-btn.active {
    border-color: #ff6b6b;
    color: #ff6b6b;
    background: #fff5f5;
}

.comment-section {
    padding: 0 0 20px;
}

.comment-list {
    margin-bottom: 16px;
}

.no-comments {
    font-size: 13px;
    color: #999;
    text-align: center;
    padding: 24px 0;
}

.comment {
    padding: 12px 0;
    border-bottom: 1px solid #f5f5f5;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comment-header strong {
    font-size: 13px;
    color: #333;
}

.comment-time {
    font-size: 11px;
    color: #aaa;
}

.comment-text {
    font-size: 14px;
    color: #444;
    line-height: 1.5;
    margin-bottom: 4px;
}

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

.reply-btn, .del-comment-btn {
    background: none;
    border: none;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    padding: 0;
}

.del-comment-btn {
    color: #ff6b6b;
}

.replies {
    margin-left: 24px;
    padding-left: 12px;
    border-left: 2px solid #eee;
    margin-top: 8px;
}

.reply {
    padding: 8px 0;
}

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

#chat-list-view {
    padding: 0;
}

#chat-list-view .header-simple {
    padding: 14px 20px;
    margin-bottom: 0;
    border-bottom: 1px solid #eee;
}

.chat-list-page {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f6f7f9;
}

.chat-card-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.chat-card {
    flex: 1;
    display: flex;
    gap: 12px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: #fff;
    text-align: left;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    cursor: pointer;
}

.chat-delete-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #f1f3f5;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-delete-btn:active {
    background: #ff6b6b;
    color: #fff;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff5f2;
    color: #ff7b54;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

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

.chat-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.chat-top strong {
    overflow: hidden;
    color: #222;
    font-size: 14px;
    word-break: break-all;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.chat-top span {
    color: #aaa;
    font-size: 11px;
    white-space: nowrap;
}

.chat-summary p {
    margin-bottom: 4px;
    color: #444;
    font-size: 13px;
    word-break: break-all;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-summary small {
    display: block;
    overflow: hidden;
    color: #999;
    font-size: 12px;
    word-break: break-all;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.empty-state {
    min-height: 55vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #999;
    text-align: center;
}

.empty-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    font-size: 24px;
}

/* ================= WRITE VIEW REFINED ================= */

#write-view {
    padding: 0; /* Remove default padding to handle fixed bottom */
}

#write-view .header-simple {
    padding: 14px 20px;
    margin-bottom: 0;
    border-bottom: 1px solid #eee;
}

.write-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px; /* Space for fixed button */
}

.bottom-fixed-action {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #eee;
    z-index: 1100;
}

/* ================= MULTI IMAGE UPLOAD ================= */

.image-upload-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 24px;
}

.image-upload-item {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    background: #f8f9fa;
    border: 1px dashed #ddd;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: #999;
    cursor: pointer;
}

.image-upload-item span {
    font-size: 11px;
    margin-top: 4px;
}

.uploaded-img {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

/* ================= COMMUNITY BLOCK EDITOR ================= */

.add-block-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 10px;
    color: #666;
    font-size: 13px;
    margin: 10px 0;
    cursor: pointer;
}

.write-block-img {
    width: 100%;
    height: 200px;
    border-radius: 12px;
    object-fit: cover;
    margin: 10px 0;
}

/* ================= CATEGORY CHIPS ================= */

.category-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.chip {
    padding: 8px 16px;
    border-radius: 999px;
    background: #f1f3f5;
    color: #495057;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.chip.active {
    background: #ff7b54;
    color: #fff;
    font-weight: bold;
}

.chip:hover {
    background: #e9ecef;
}

.chip.active:hover {
    background: #ff7b54;
}

/* ================= TYPE SELECTOR ================= */

.type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.type-btn {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #eee;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
}

.type-btn.active {
    background: #ff7b54;
    color: #fff;
    border-color: #ff7b54;
    font-weight: bold;
}

.form-container textarea {
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    resize: none;
    width: 100%;
}

.form-container textarea:focus {
    outline: none;
    border-color: #ff7b54;
}

.back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.form-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.input-group input {
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
}

.input-group input:focus {
    outline: none;
    border-color: #ff7b54;
}

.checkbox-row {
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #ff7b54;
    cursor: pointer;
}

.input-row {
    display: flex;
    gap: 8px;
}

.input-row input {
    flex: 1;
}

.check-btn {
    flex-shrink: 0;
    padding: 0 14px;
    border: 1px solid #ff7b54;
    border-radius: 10px;
    background: #fff;
    color: #ff7b54;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.check-btn:active {
    background: #ff7b54;
    color: #fff;
}

/* ================= COMMON COMPONENTS ================= */

.primary-btn {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    background: #ff7b54;
    color: #fff;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.bottom-action {
    width: 100%;
    margin-bottom: 20px;
}

/* ================= FILTER ================= */

.sharing-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0 12px;
}

.filter-icon-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid #eee;
    border-radius: 999px;
    background: #fff;
    color: #333;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

.filter-summary {
    overflow: hidden;
    color: #868e96;
    font-size: 12px;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-icon-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid #eee;
    border-radius: 999px;
    background: #fff;
    font-size: 16px;
    cursor: pointer;
}

.sharing-search-panel {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.24s ease, padding 0.24s ease;
    padding: 0 2px;
}

.sharing-search-panel.open {
    max-height: 60px;
    padding: 6px 2px 12px;
}

.sharing-search-row {
    display: flex;
    gap: 8px;
}

.sharing-search-row input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 14px;
}

.sharing-search-row input:focus {
    outline: none;
    border-color: #ff7b54;
}

.sharing-search-clear {
    flex-shrink: 0;
    padding: 0 14px;
    border: 1px solid #eee;
    border-radius: 10px;
    background: #fff;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.sharing-search-clear:active {
    background: #f1f3f5;
}

.filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
}

.filter-bar button {
    border: none;
    background: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
    border: 1px solid #eee;
    cursor: pointer;
}

.filter-bar button.active {
    background: #ff7b54;
    color: #fff;
    border-color: #ff7b54;
    font-weight: bold;
}

.filter-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 1900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.filter-popup-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.filter-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
}

.filter-popup-panel {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    padding: 18px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.16);
    transform: translateY(24px);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.filter-popup-overlay.active .filter-popup-panel {
    transform: translateY(0);
}

.filter-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.filter-popup-header h2 {
    font-size: 17px;
    color: #222;
}

.filter-popup-close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #f1f3f5;
    font-size: 15px;
    cursor: pointer;
}

.filter-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow-y: auto;
    padding: 0 0 14px;
}

.filter-popup-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.filter-reset-btn,
.filter-apply-btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.filter-reset-btn {
    border: 1px solid #eee;
    background: #fff;
    color: #666;
}

.filter-apply-btn {
    border: 1px solid #ff7b54;
    background: #ff7b54;
    color: #fff;
}

/* ================= CARD LIST ================= */

.list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ================= CARD ================= */

.card {
    display: flex;
    gap: 12px;

    background: #fff;
    padding: 12px;
    border-radius: 14px;

    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    
    height: 110px; /* Increased height to prevent clipping */
    align-items: flex-start; /* Align thumbnail and content to top */
}

/* ================= THUMB ================= */

.thumb {
    width: 86px; /* Slightly larger thumb to fit new height */
    height: 86px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    background: #eee;
}

#sharing-view .thumb {
    width: 86px;
    height: 86px;
}

/* ================= CONTENT ================= */

.content-area {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Align content to top */
    height: 100%;
}

#sharing-view .desc {
    display: none;
}

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

#sharing-view .card {
    align-items: center; /* Keep sharing view centered vertically */
}

#sharing-view .content-area {
    justify-content: center;
}

/* ================= TEXT ================= */

h3 {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    word-break: break-all;
    overflow-wrap: break-word;
    
    /* Default: 1 line truncation */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#sharing-view h3 {
    /* Sharing: 2 lines truncation */
    -webkit-line-clamp: 2;
}

.desc {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-top: 6px; /* Spacing from title */
    word-break: break-all;
    overflow-wrap: break-word;

    /* 2 lines truncation */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ================= BADGE ================= */

.badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f1f3f5;
    color: #495057;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-active {
    background: #ffedd5;
    color: #ff7b54;
}

.badge-done {
    background: #e9ecef;
    color: #868e96;
}

/* ================= META ================= */

.meta {
    font-size: 11px;
    color: #999;
}

.category {
    font-size: 12px;
    color: #ff7b54;
    font-weight: bold;
}

/* ================= WRITE BUTTON ================= */

.write-btn {
    position: fixed;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);

    width: 70%;
    max-width: 420px;

    padding: 14px 0;

    border-radius: 999px;
    background: #ff7b54;
    color: #fff;
    border: none;

    font-size: 15px;
    font-weight: bold;

    box-shadow: 0 6px 16px rgba(0,0,0,0.15);

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================= MENU POPUP ================= */

.menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
}

.menu-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(320px, 86vw);
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #fff;
    box-shadow: -8px 0 24px rgba(0,0,0,0.14);
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.menu-overlay.active .menu-panel {
    transform: translateX(0);
}

.menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 18px;
    border-bottom: 1px solid #eee;
}

.menu-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.menu-profile-avatar {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff5f2;
    font-size: 22px;
    flex-shrink: 0;
}

.menu-profile-name {
    max-width: 180px;
    overflow: hidden;
    color: #222;
    font-size: 15px;
    font-weight: bold;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f3f5;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
}

.menu-list {
    flex: 0 0 auto;
    padding: 8px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 14px 24px;
    border: none;
    background: none;
    font-size: 16px;
    color: #222;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.menu-item:active {
    background: #f5f5f5;
}

.menu-spacer {
    flex: 1;
}

.menu-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.menu-logout-btn {
    padding: 4px 0;
    border: none;
    background: none;
    color: #ff3b30;
    font-size: 12px;
    font-weight: normal;
    cursor: pointer;
}

.menu-policy-links {
    display: flex;
    gap: 4px;
}

.menu-policy-btn {
    background: none;
    border: none;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: underline;
}

.menu-policy-btn:active {
    color: #ff7b54;
}

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

#chat-room-view {
    padding: 0;
    display: none;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

#chat-room-view.active {
    display: flex;
}

.chat-room-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
}

.chat-room-header .chat-room-title {
    font-size: 16px;
    font-weight: bold;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-room-status-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 20px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    min-height: 36px;
}

.chat-room-status-bar .status-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e9ecef;
    color: #868e96;
    white-space: nowrap;
}

.chat-room-status-bar .status-badge.badge-active {
    background: #ffedd5;
    color: #ff7b54;
}

.chat-room-status-bar .status-badge.badge-done {
    background: #e9ecef;
    color: #868e96;
}

.chat-room-status-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    border: 1px solid #ff7b54;
    border-radius: 999px;
    background: #fff;
    color: #ff7b54;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.chat-room-status-btn:active {
    background: #ff7b54;
    color: #fff;
}

.chat-room-status-btn.done {
    border-color: #868e96;
    color: #868e96;
}

.chat-room-status-btn.done:active {
    background: #868e96;
    color: #fff;
}

.chat-room-status-btn.active {
    background: #ff7b54;
    color: #fff;
    border-color: #ff7b54;
}

.chat-room-status-btn.active:active {
    opacity: 0.8;
}

.chat-room-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.chat-message.mine {
    align-self: flex-end;
    background: #ff7b54;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-message.other {
    align-self: flex-start;
    background: #f1f3f5;
    color: #333;
    border-bottom-left-radius: 4px;
}

.chat-message-time {
    font-size: 10px;
    color: #aaa;
    margin-top: 4px;
    text-align: right;
}

.chat-message.other .chat-message-time {
    text-align: left;
}

.chat-room-input-bar {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid #eee;
}

.chat-room-input-bar input {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
}

.chat-room-input-bar input:focus {
    outline: none;
    border-color: #ff7b54;
}

.chat-room-send {
    flex-shrink: 0;
    padding: 0 20px;
    border: none;
    border-radius: 24px;
    background: #ff7b54;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}

.chat-room-send:active {
    opacity: 0.8;
}

.chat-room-input-bar input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.chat-room-input-bar.disabled {
    opacity: 0.6;
}

.chat-room-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ================= SHIPPING ================= */

.shipping-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shipping-popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
}

.shipping-popup-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.shipping-popup-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    z-index: 2;
}

.shipping-popup-img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 12px;
    object-fit: contain;
}

.shipping-popup-confirm {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: #ff7b54;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.shipping-popup-confirm:active {
    opacity: 0.8;
}

.shipping-popup-reupload {
    width: 100%;
    padding: 14px;
    border: 1px solid #ff7b54;
    border-radius: 12px;
    background: #fff;
    color: #ff7b54;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.shipping-popup-reupload:active {
    background: #ff7b54;
    color: #fff;
}

.shipping-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.shipping-popup-actions .popup-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.shipping-popup-actions .popup-btn.primary {
    background: #ff7b54;
    color: #fff;
}

.shipping-popup-actions .popup-btn.primary:active {
    opacity: 0.8;
}

.shipping-popup-actions .popup-btn.outline {
    background: #fff;
    color: #ff7b54;
    border: 1px solid #ff7b54;
}

.shipping-popup-actions .popup-btn.outline:active {
    background: #ff7b54;
    color: #fff;
}

/* ================= BOTTOM TAB ================= */

.bottom-tab {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;

    height: 62px;
    background: #fff;
    border-top: 1px solid #eee;

    display: flex;
    justify-content: space-around;
    align-items: center;

    z-index: 100;
}

.bottom-item {
    background: none;
    border: none;

    font-size: 12px;
    color: #888;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;

    cursor: pointer;
}

.bottom-item.active {
    color: #ff7b54;
    font-weight: bold;
}

.bottom-item.disabled {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: not-allowed;
}

.status-bar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.status-bar-inner.clickable {
    cursor: pointer;
}

.status-hint {
    font-size: 11px;
    color: #999;
}

.badge-empty {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e9ecef;
    color: #868e96;
}

/* ================= POLICY PAGES ================= */

.policy-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 40px;
}

.policy-content {
    line-height: 1.8;
    color: #444;
    font-size: 14px;
}

.policy-content h2 {
    font-size: 22px;
    color: #222;
    margin-bottom: 8px;
}

.policy-content .policy-date {
    font-size: 12px;
    color: #999;
    margin-bottom: 28px;
}

.policy-content h3 {
    font-size: 16px;
    color: #333;
    margin-top: 24px;
    margin-bottom: 8px;
}

.policy-content p {
    margin-bottom: 12px;
    font-size: 14px;
    color: #555;
}

.policy-content ul {
    padding-left: 20px;
    margin-bottom: 12px;
}

.policy-content ul li {
    font-size: 14px;
    color: #555;
    margin-bottom: 4px;
    list-style: disc;
}

/* ================= AGREEMENT CHECKBOXES ================= */

.agreement-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}

.agreement-check-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.agreement-check-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ff7b54;
    cursor: pointer;
}

.agreement-text {
    flex: 1;
    font-size: 13px;
    color: #555;
}

.agreement-view-btn {
    background: none;
    border: none;
    color: #ff7b54;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    text-decoration: underline;
    white-space: nowrap;
}

.agreement-view-btn:active {
    color: #e06540;
}

/* ================= MENU POLICY LINKS ================= */

.menu-policy-links {
    display: flex;
    gap: 4px;
    padding: 8px 0;
    flex-wrap: wrap;
}

.menu-policy-btn {
    background: none;
    border: none;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    padding: 6px 8px;
    text-decoration: underline;
}

.menu-policy-btn:active {
    color: #ff7b54;
}

/* ================= ADS ================= */

.ad-card {
    background: #fff;
    padding: 12px;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.menu-ad-banner {
    padding: 8px 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}
