:root {
    --primary-gold: #d4af37;
    --dark-gold: #b8860b;
    --text-color: #333;
    --sub-text: #888;
    --border-color: #eee;
    --card-shadow: 0 15px 45px rgba(0, 0, 0, 0.08);
    --heart-red: #ff4757;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { overflow-x: hidden; width: 100%; }
body { font-family: 'Noto Sans KR', sans-serif; background: #fff; color: var(--text-color); }
.app-container { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 0.5rem 2rem 2rem 2rem; width: 100%; max-width: 1300px; margin: 0 auto; }

/* --- 1. Main Header --- */
.main-header { display: flex !important; flex-direction: column !important; justify-content: center !important; align-items: center !important; margin-bottom: 1.5rem; width: 100%; position: relative; padding: 3rem 1rem 1rem 1rem; }
#auth-zone { position: absolute !important; top: 1rem; right: 1rem; z-index: 1000; }
.logo-container { display: flex !important; flex-direction: column !important; align-items: center !important; width: 100%; }
.main-logo-img { width: 300px; height: auto; }

/* --- 2. Sub Header --- */
.sub-header { width: 100%; display: flex; flex-direction: column; align-items: center; margin-bottom: 2.5rem; padding: 7rem 0 1.2rem 0; border-bottom: 1px solid #f0f0f0; position: relative; }
#auth-zone-sub { position: absolute; top: 1rem; right: 0; z-index: 1000; }
.header-left { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.back-btn { color: #333; display: flex; align-items: center; text-decoration: none; transition: 0.3s; }
.page-title { font-size: 1.8rem; font-weight: 800; color: #111; }

/* --- 3. Auth UI --- */
.login-form { display: flex; gap: 1.2rem; background: white; padding: 0.6rem 1.5rem; border-radius: 50px; box-shadow: 0 4px 20px rgba(0,0,0,0.06); border: 1px solid rgba(212, 175, 55, 0.25); align-items: center; }
.login-form-inputs { display: flex; gap: 0.8rem; }
.login-form input { border: none; outline: none; width: 100px; font-size: 0.85rem; background: transparent; border-bottom: 1px solid #f0f0f0; padding: 2px 0; font-family: inherit; }
.auth-btn-group { display: flex; gap: 0.5rem; }
.login-form button { background: var(--primary-gold); color: white; border: none; padding: 0.5rem 1.4rem; border-radius: 20px; font-weight: 700; cursor: pointer; transition: 0.3s; white-space: nowrap; font-size: 0.85rem; }

/* --- 4. Menu Grid --- */
.menu-grid { display: flex !important; flex-direction: row !important; justify-content: center !important; gap: 1.5rem !important; width: 100%; margin-top: 0.5rem; }
.menu-grid trend-card { flex: 1; max-width: 220px; }

/* --- 5. Common Content Wrapper --- */
.content-wrapper { width: 100%; max-width: 1100px; margin: 0 auto; }

/* --- 6. Board Grid --- */
.popup-grid { display: grid !important; grid-template-columns: repeat(4, 1fr) !important; gap: 2rem !important; width: 100%; margin-top: 1rem; }
.popup-card { background: #fff; border-radius: 20px; border: 1px solid #eee; overflow: hidden; transition: 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); cursor: pointer; position: relative; }
.popup-card img { width: 100%; height: 220px; object-fit: cover; border-bottom: 1px solid #f5f5f5; }
.popup-info { padding: 1.5rem; }
.popup-tag { color: var(--primary-gold); font-weight: 800; font-size: 0.8rem; margin-bottom: 0.5rem; }
.popup-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.8rem; color: #222; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.popup-author { font-size: 0.8rem; color: #999; display: flex; align-items: center; gap: 0.4rem; }

/* --- 7. Write Accordion --- */
.write-card { background: white; border-radius: 20px; border-top: 5px solid var(--primary-gold); box-shadow: var(--card-shadow); overflow: hidden; margin-bottom: 3.5rem; width: 100%; }
.write-header { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 2rem; cursor: pointer; background: #fff; }
.write-header h2 { font-size: 1.2rem; font-weight: 700; color: #333; }
.write-body { max-height: 0; overflow: hidden; transition: max-height 0.5s ease-out; }
.write-body.active { max-height: 1500px; border-top: 1px solid #f5f5f5; }
.write-body form { padding: 2.5rem 3rem; display: flex; flex-direction: column; gap: 1.2rem; }
.write-body input, .write-body select, .write-body textarea { width: 100%; padding: 1rem 1.5rem; border: 1px solid #eee; border-radius: 50px; background: #fcfcfc; font-size: 1rem; font-family: inherit; outline: none; }
.form-row { display: flex; gap: 1rem; }
.btn-submit { background: var(--primary-gold); color: white; border: none; padding: 0.8rem 2rem; border-radius: 50px; font-weight: 700; cursor: pointer; }

/* --- 8. Search Bar --- */
.search-bar-premium { width: 100%; display: flex; flex-direction: column; gap: 1.2rem; background: #fff; padding: 1.5rem; border-radius: 30px; box-shadow: 0 10px 35px rgba(0,0,0,0.05); border: 1px solid #f0f0f0; margin-bottom: 4rem; }
.search-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1.2rem; border-bottom: 1px solid #f8f8f8; }
.filter-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filter-tab { background: #f8f8f8; border: 1px solid #eee; padding: 0.6rem 1.2rem; border-radius: 50px; cursor: pointer; font-weight: 700; font-size: 0.85rem; color: #777; transition: 0.3s; white-space: nowrap; }
.filter-tab.active { background: var(--primary-gold); border-color: var(--primary-gold); color: white; }
#storeFilterSelect { border: 1px solid #eee; border-radius: 50px; padding: 0.6rem 1.2rem; outline: none; background: #fafafa; font-size: 0.85rem; min-width: 150px; }
.search-input-row { display: flex; gap: 0.8rem; width: 100%; }
.search-input-row input { flex: 1; border: 1px solid #eee; border-radius: 50px; padding: 0.8rem 1.5rem; outline: none; background: #fafafa; font-size: 0.95rem; transition: 0.3s; }
.search-input-row button { background: #333; color: white; border: none; padding: 0 2.5rem; border-radius: 50px; cursor: pointer; font-weight: 700; }

/* --- 9. Detail View --- */
.detail-view { width: 100%; max-width: 950px; margin: 0 auto; background: white; border-radius: 35px; padding: 4rem; box-shadow: var(--card-shadow); border-top: 8px solid var(--primary-gold); position: relative; }
.social-actions { display: flex !important; flex-direction: row !important; gap: 2rem !important; margin-bottom: 2.5rem; border-bottom: 1px solid #f5f5f5; padding-bottom: 2rem; align-items: center; }
.action-item { display: flex !important; flex-direction: row !important; align-items: center !important; gap: 0.8rem; cursor: pointer; color: #666; font-size: 1rem; font-weight: 700; transition: 0.3s; white-space: nowrap; }
.action-item svg { width: 24px; height: 24px; stroke: #666; fill: none; stroke-width: 2; transition: 0.3s; }
.heart-btn.active svg { fill: var(--heart-red); stroke: var(--heart-red); transform: scale(1.25); }

.post-gallery { width: 100%; margin: 2rem 0; text-align: center; }
.post-gallery img { max-width: 100%; height: auto; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }

.post-admin-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid #f5f5f5; }
.btn-admin { padding: 0.8rem 2rem; border-radius: 50px; border: 1px solid #eee; background: #fff; color: #666; font-weight: 700; cursor: pointer; transition: 0.3s; font-size: 0.9rem; }
.btn-admin:hover { background: #f8f8f8; border-color: #ddd; }
.btn-admin.primary { background: var(--primary-gold); border-color: var(--primary-gold); color: white; }
.btn-admin.danger { color: #ff4757; border-color: #ffe0e0; background: #fff5f5; }

/* --- 10. Comment Section --- */
.comment-section { margin-top: 4rem; border-top: 1px solid #eee; padding-top: 3rem; }
.comment-form { display: flex; gap: 1rem; margin-bottom: 3rem; }
.comment-form textarea { flex: 1; padding: 1.2rem 1.5rem; border: 1px solid #eee; border-radius: 20px; background: #fafafa; font-family: inherit; font-size: 0.95rem; outline: none; resize: none; height: 80px; }
.comment-form button { background: #333; color: white; border: none; padding: 0 2rem; border-radius: 20px; font-weight: 700; cursor: pointer; }
.comment-item { background: #fdfdfd; padding: 1.5rem; border-radius: 20px; border: 1px solid #f5f5f5; margin-bottom: 1.5rem; }

/* --- 11. Footer --- */
.main-footer { width: 100%; margin-top: 3rem; padding: 2rem 0; text-align: center; border-top: 1px solid #f0f0f0; background: #fafafa; }
.main-footer p { font-family: 'Noto Sans KR', sans-serif; font-size: 1.1rem; color: var(--dark-gold); font-weight: 800; margin-bottom: 0.8rem; white-space: nowrap; }
.footer-published { display: block; font-family: 'Noto Sans KR', sans-serif; font-size: 0.8rem; color: #aaa; font-weight: 500; text-transform: uppercase; letter-spacing: 0.2rem; white-space: nowrap; }

/* --- 12. Modals --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.65); backdrop-filter: blur(10px); display: none; align-items: center; justify-content: center; z-index: 9999; }
.modal-overlay.open { display: flex; }
.auth-modal { background: #fff; width: 95%; max-width: 520px; padding: 4rem; border-radius: 40px; border-top: 10px solid var(--primary-gold); position: relative; }
.auth-modal form { display: flex; flex-direction: column; gap: 1.2rem; }
.auth-modal input, .auth-modal select { 
    width: 100%; 
    padding: 1.1rem 1.5rem; 
    border: 1px solid #eee; 
    border-radius: 15px; 
    background: #fcfcfc; 
    font-size: 1rem; 
    font-family: inherit; 
    outline: none; 
    transition: all 0.3s ease;
    color: #333;
}
.auth-modal input::placeholder { color: #bbb; }
.auth-modal input:focus, .auth-modal select:focus { 
    border-color: var(--primary-gold); 
    background: #fff; 
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1); 
}
.auth-modal select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1.5rem center; background-size: 1.2rem; }

/* ====================================================== */
/* --- MOBILE RE-OPTIMIZATION (V7 - Premium Polish) --- */
/* ====================================================== */
@media (max-width: 768px) {
    .app-container { padding: 1rem !important; }

    /* 1. Header & Full-Width Login (Top) */
    .main-header { 
        padding: 7.5rem 0.5rem 1rem 0.5rem !important; /* 모바일 상단 패딩을 7.5rem으로 확대 */
        margin-bottom: 2rem !important; 
        position: relative !important; 
        display: flex !important;
        flex-direction: column !important; /* 순서 보정 */
        align-items: center !important; 
    }
    #auth-zone { 
        position: absolute !important; 
        top: 1rem !important; 
        right: 0.5rem !important; 
        width: auto !important; 
        margin-bottom: 0 !important;
        z-index: 1000;
    }
    .main-logo-img { width: 160px !important; margin-top: 0.5rem !important; }
    .sub-logo-img { width: 160px !important; }
    
    .login-form { 
        padding: 0.6rem 1rem !important; 
        gap: 0.6rem !important; 
        border-radius: 20px !important; 
        background: rgba(255,255,255,0.98) !important;
        box-shadow: 0 8px 25px rgba(0,0,0,0.08) !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
    }
    .login-form.logged-in { padding: 0.6rem 1rem !important; }
    .login-form-inputs { gap: 0.6rem !important; flex-direction: row !important; flex: 1 !important; justify-content: center !important; }
    .login-form input { 
        width: 85px !important; font-size: 0.8rem !important; border-bottom: 1px solid #eee !important; 
        padding: 4px !important; height: 30px !important;
    }
    .auth-btn-group { display: flex !important; gap: 0.5rem !important; width: auto !important; }
    .login-form button { 
        padding: 0.5rem 1rem !important; font-size: 0.75rem !important; border-radius: 10px !important; white-space: nowrap !important;
    }

    /* 2. Menu Grid (Responsive Layout) */
    .menu-grid { 
        display: grid !important; 
        grid-template-columns: 1fr 1fr !important; 
        gap: 2.5rem 1.2rem !important; /* 세로 간격 2.5rem으로 대폭 확대 */
        margin-top: 1rem !important; 
        width: 100% !important; 
        padding: 0 0.5rem !important;
    }

    /* 3. Sub Header & Detail Adjustments */
    .sub-header { 
        flex-direction: column !important; 
        gap: 1rem !important; 
        padding: 0.8rem 0 !important; 
        position: relative; 
        align-items: center !important;
        border-bottom: none !important;
    }
    #auth-zone-sub { 
        position: static !important; 
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        transform: scale(0.9) !important;
        margin-top: 0.5rem !important;
    }
    .header-left { 
        width: 100% !important; 
        display: flex !important;
        justify-content: center !important; 
        align-items: center !important;
        position: relative !important;
        margin-bottom: 0.5rem; 
    }
    .back-btn { 
        position: absolute !important; 
        left: 0 !important; 
        top: 50% !important; 
        transform: translateY(-50%) !important; 
    }
    .page-title { font-size: 1.2rem !important; text-align: center !important; margin: 0 auto !important; }

    /* 4. Board List (Rollback to 1 column) */
    .popup-grid { 
        grid-template-columns: 1fr !important; 
        gap: 1.5rem !important; 
    }
    .popup-card img { height: 180px !important; }
    
    /* 5. Auth Modal (Redesign) */
    .auth-modal { 
        padding: 2.5rem 2rem !important; 
        width: 90% !important; 
        border-radius: 25px !important; 
        border-top: 6px solid var(--primary-gold) !important;
    }
    .auth-modal h2 { font-size: 1.8rem !important; }
    .auth-modal input, .auth-modal select { 
        padding: 0.8rem 1.2rem !important; 
        font-size: 0.9rem !important;
        border-radius: 12px !important;
    }

    /* 6. Search Bar Optimization */
    .search-bar-premium { 
        padding: 1rem !important; 
        gap: 1rem !important; 
        margin-bottom: 2.5rem !important;
        width: 100% !important;
        border-radius: 20px !important;
    }
    .search-filter-row { 
        flex-direction: column !important; 
        align-items: stretch !important; 
        gap: 0.8rem !important;
        padding-bottom: 0.8rem !important;
    }
    .filter-tabs { gap: 0.3rem !important; justify-content: center !important; }
    .filter-tab { padding: 0.5rem 0.8rem !important; font-size: 0.75rem !important; }
    #storeFilterSelect { width: 100% !important; min-width: 0 !important; }
    .search-input-row { gap: 0.5rem !important; }
    .search-input-row input { padding: 0.7rem 1.2rem !important; font-size: 0.85rem !important; }
    .search-input-row button { padding: 0 1.2rem !important; font-size: 0.85rem !important; }
    
    /* 7. Form & Detail */
    .write-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out; }
    .write-body.active { max-height: 1500px; }
    .form-row { flex-direction: column !important; gap: 0.8rem; }
    .detail-view { padding: 1.5rem 1rem !important; width: 100% !important; border-radius: 0 !important; }
    .post-admin-actions { flex-wrap: wrap !important; gap: 0.5rem !important; }
    .btn-admin { padding: 0.6rem 1rem !important; font-size: 0.8rem !important; flex: 1; text-align: center; }
    
    /* 7. Footer */
    .main-footer { margin-top: 4rem !important; padding: 2.5rem 1rem !important; }
    .main-footer p, .footer-published { font-size: 0.75rem !important; }
}
