/* ===== COMPONENTS: Toast, Modal, Animations, Tabs ===== */

/* ===== Section Banners ===== */
.section-banner {
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 16px;
    color: white;
    position: relative;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.section-banner h3 {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.section-banner p {
    margin-top: 0.5rem;
    opacity: 0.9;
    font-size: 0.85rem;
}
.section-banner::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    pointer-events: none;
}
@media (max-width: 768px) {
    .section-banner {
        padding: 16px;
        min-height: 90px;
    }
    .section-banner h3 { font-size: 1rem; }
    .section-banner p { font-size: 0.75rem; }
}


/* ===== Registration Modal ===== */
.register-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.register-modal-overlay.active {
    display: flex;
}
.register-modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
    animation: modalSlideIn 0.25s ease;
    color: var(--text);
    border: 1px solid var(--border);
}
@keyframes modalSlideIn {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.register-modal-content .modal-close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}
.register-modal-content .modal-close-btn:hover {
    color: var(--text);
}

/* Admin register button */
.admin-register-btn {
    background: linear-gradient(135deg, #0066cc, #0052a3);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: none;
}
.admin-register-btn:hover {
    filter: brightness(1.1);
}


/* ===== Notification Toggle Switch ===== */
.notif-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.3s;
}
.notif-toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
input:checked + .notif-toggle-slider {
    background: #4CAF50;
}
input:checked + .notif-toggle-slider::before {
    transform: translateX(20px);
}


/* ===== Notification Toast (colored) ===== */
.notif-toast {
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    border-radius: 10px !important;
    padding: 0.7rem 1rem !important;
    color: white !important;
}


/* ===== Product Detail Image Gallery ===== */
#pd-gallery {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#pd-gallery::-webkit-scrollbar { display: none; }


/* ===== SEARCH OVERLAY ===== */
.search-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); z-index: 9999; align-items: flex-start; justify-content: center; padding-top: 10vh; }
.search-overlay.active { display: flex; }
.search-header { display: flex; align-items: center; padding: 1rem; border-bottom: 1px solid var(--border); }
.search-input { flex: 1; border: none; outline: none; font-size: 1.1rem; padding: 0.5rem; background: transparent; color: var(--text); }
.search-close-btn { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 0.5rem; color: var(--accent); }
.search-results { overflow-y: auto; padding: 1rem; flex: 1; }
.search-hint, .search-empty { text-align: center; color: var(--accent); padding: 2rem 0; }
.search-category { margin-bottom: 1rem; }
.search-category h4 { font-size: 0.85rem; color: var(--accent); margin-bottom: 0.5rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--border); }
.search-result-item { padding: 0.6rem 0.5rem; cursor: pointer; border-radius: 6px; font-size: 0.9rem; transition: background 0.15s; }
.search-result-item:hover { background: var(--bg); }

/* ===== SETTINGS ===== */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 768px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-card h4 { margin-bottom: 0.8rem; }
.settings-btn:hover { background: var(--border); }
.settings-btn-danger { color: #e53935; border-color: rgba(229,57,53,0.3); }
.settings-btn-danger:hover { background: rgba(229,57,53,0.15); }
.settings-toggle { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; cursor: pointer; font-size: 0.9rem; }
.settings-toggle input[type="checkbox"] { width: 40px; height: 22px; appearance: none; background: var(--border); border-radius: 11px; position: relative; cursor: pointer; transition: background 0.2s; }
.settings-toggle input[type="checkbox"]:checked { background: #2e7d32; }
.settings-toggle input[type="checkbox"]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: white; border-radius: 50%; transition: transform 0.2s; }
.settings-toggle input[type="checkbox"]:checked::after { transform: translateX(18px); }
.settings-lang-list { display: flex; flex-direction: column; gap: 0.4rem; }
.settings-radio { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem; cursor: pointer; font-size: 0.9rem; }
.settings-radio input[type="radio"] { accent-color: var(--primary); }


/* ===== BRAND: Section headers gold underline ===== */
.page > h2 {
    position: relative;
    padding-bottom: 0.5rem;
}
.page > h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--gold);
    border-radius: 2px;
}

/* ===== BRAND: Links/accents ===== */
a:not(.nav-item) {
    color: var(--gold-dark);
}


/* ===== MOBILE: Modal safety ===== */
@media (max-width: 768px) {
    .modal-content,
    .register-modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Search overlay fullscreen */
    .search-overlay-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    .search-overlay {
        padding-top: 0;
    }
    
    /* Gallery grid mobile 2col */
    #art-gallery {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Touch targets enforcement */
    button, a.nav-item, .tab-btn, .credit-tab, .btn-chat, .btn-logout,
    .post-actions button, .chat-input button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Button padding minimum */
    button {
        padding: 0.6rem;
    }
    
    /* Sidebar user-info in dark sidebar */
    .user-info {
        color: rgba(255,255,255,0.8);
        border-bottom-color: rgba(255,255,255,0.1);
    }
    .user-info .btn-logout {
        color: rgba(255,255,255,0.7);
        border-color: rgba(255,255,255,0.2);
    }
}

/* Sidebar user-info brand styling */
.sidebar .user-info {
    color: rgba(255,255,255,0.8);
    border-bottom-color: rgba(255,255,255,0.1);
}
.sidebar .user-info .btn-logout {
    color: rgba(255,255,255,0.7);
    border-color: rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
}
.sidebar .user-info .btn-logout:hover {
    background: rgba(255,255,255,0.15);
    color: var(--gold);
}

/* Sidebar search button brand */
.sidebar div[style*="padding:0.5rem"] button {
    color: rgba(255,255,255,0.5) !important;
    border-color: rgba(255,255,255,0.15) !important;
    background: rgba(255,255,255,0.05) !important;
}

/* CREB LABS category tabs */
.creb-tab.active { font-weight: 700; }
.creb-tab:hover { opacity: 0.8; }


/* Responsive */
@media (max-width: 768px) {
    .care-clock { font-size: 3rem; }
    .care-sos-btn { width: 120px; height: 120px; font-size: 1.6rem; }
    .care-board-clock { font-size: 5rem; }
    .care-board-date { font-size: 1.4rem; }
    .sos-countdown-number { font-size: 5rem; }
    .sos-countdown-title { font-size: 1.4rem; }
    .sos-emergency-btn { min-height: 80px; font-size: 1.3rem; }
}


/* ===== SKELETON SHIMMER ===== */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, var(--dark-card) 25%, var(--dark-card-alt) 50%, var(--dark-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
.skeleton-circle { border-radius: 50%; }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-image { width: 100%; padding-top: 100%; }

.skeleton-post {
    padding: 1rem;
    background: var(--dark-card);
    border-radius: 12px;
    margin-bottom: 1rem;
}

/* ===== PAGE FADE IN ===== */
.page.active {
    animation: pageFadeIn 0.2s ease;
}
@keyframes pageFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== HEART POP ANIMATION (improved) ===== */
@keyframes heartPop {
    0% { transform: translate(-50%,-50%) scale(0); opacity: 1; }
    15% { transform: translate(-50%,-50%) scale(1.3); opacity: 1; }
    30% { transform: translate(-50%,-50%) scale(0.95); opacity: 1; }
    45% { transform: translate(-50%,-50%) scale(1.1); opacity: 1; }
    80% { transform: translate(-50%,-50%) scale(1); opacity: 0.8; }
    100% { transform: translate(-50%,-50%) scale(1); opacity: 0; }
}


/* ===== BOTTOM TAB BAR (Mobile) ===== */
.bottom-tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card, #1a1a2e);
    border-top: 1px solid var(--border, #2a2a3e);
    z-index: 999;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-tab-bar-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 56px;
}
.bottom-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    padding: 4px 12px;
    border: none;
    background: none;
    color: var(--text-muted, #888);
    font-size: 0.6rem;
    font-weight: 600;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
    min-width: 48px;
    min-height: 44px;
}
.bottom-tab-item .tab-icon {
    font-size: 1.4rem;
    line-height: 1;
}
.bottom-tab-item.create-btn .tab-icon {
    background: linear-gradient(135deg, var(--gold, #FFD700), #e6c040);
    color: #000;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

@media (max-width: 768px) {
    .bottom-tab-bar { display: block; }
    .content {
        padding-bottom: 70px !important;
    }
}


/* ===== FRIENDS GRID (dark) ===== */
.friends-grid { display: none !important; }

/* ===== FEED container max width ===== */
@media (min-width: 769px) {
    #social-feed-wrapper {
        max-width: 470px;
        margin: 0 auto;
    }
    #story-ring-container {
        max-width: 470px;
        margin: 0 auto !important;
    }
}


/* ===== UNIFIED UI COMPONENTS (v21) ===== */

/* Toast messages */
.notif-toast, .toast-message {
    background: var(--bg-card, #1a1a2e) !important;
    color: var(--text, #f0f0f0) !important;
    border: 1px solid var(--border, #2a2a3e) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
    font-size: 0.9rem !important;
}

/* Loading spinner - gold */
.loading-spinner, .spinner {
    border-color: var(--border, #2a2a3e) !important;
    border-top-color: var(--gold, #D4AF37) !important;
}

/* Empty state unified */
.empty-state, .art-empty-state, .chat-empty-state {
    color: var(--text-muted, #888) !important;
}
.empty-state .icon, .art-empty-state .icon {
    opacity: 0.6;
}

/* Post create "게시" button gold */
.post-create .btn-primary {
    background: var(--gold, #D4AF37) !important;
    color: #000 !important;
    font-weight: 700;
}

/* Input fields unified */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
textarea, select {
    background: var(--bg-card-alt, #1e1e3a) !important;
    color: var(--text, #f0f0f0) !important;
    border-color: var(--border, #2a2a3e) !important;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--gold, #D4AF37) !important;
    outline: none;
}

/* Modal overlay unified */
.modal, .register-modal-overlay, .bottom-sheet-overlay {
    background: rgba(0,0,0,0.7) !important;
}

/* Sidebar unified */

/* Menu toggle dark */
.menu-toggle {
    background: var(--bg-card, #1a1a2e) !important;
    color: var(--text, #f0f0f0) !important;
    border-color: var(--border, #2a2a3e) !important;
}

/* Unified secondary buttons */
.btn-secondary {
    background: var(--bg-card-alt, #1e1e3a) !important;
    color: var(--text, #f0f0f0) !important;
    border-color: var(--border, #2a2a3e) !important;
}

/* Profile modals dark */
#profile-edit-modal > div,
#add-contact-modal > div,
.group-member-select-modal {
    background: var(--bg-card, #1a1a2e) !important;
    color: var(--text, #f0f0f0) !important;
}
#profile-edit-modal input,
#add-contact-modal input {
    background: var(--bg-card-alt, #1e1e3a) !important;
    color: var(--text, #f0f0f0) !important;
    border-color: var(--border, #2a2a3e) !important;
}

/* Service card hover gold */
.service-card:hover {
    border-color: var(--gold, #D4AF37) !important;
}

/* Search overlay dark */
.search-overlay-content {
    background: var(--bg-card, #1a1a2e) !important;
    color: var(--text, #f0f0f0) !important;
}

/* Settings dark */
.settings-card {
    background: var(--bg-card, #1a1a2e) !important;
    color: var(--text, #f0f0f0) !important;
}
.settings-btn {
    background: var(--bg-card-alt, #1e1e3a) !important;
    color: var(--text, #f0f0f0) !important;
    border-color: var(--border, #2a2a3e) !important;
}

/* Comment bottom sheet dark */
.bottom-sheet {
    background: var(--bg-card, #1a1a2e) !important;
    color: var(--text, #f0f0f0) !important;
}

/* Link preview dark */
.link-preview-card {
    background: var(--bg-card-alt, #1e1e3a) !important;
    border-color: var(--border, #2a2a3e) !important;
    color: var(--text, #f0f0f0) !important;
}

/* All hardcoded white backgrounds → dark */
.wallet-btn, .product-card, .credit-header, .trading-panel,
.trading-header, .balance-item {
    background: var(--bg-card, #1a1a2e) !important;
    color: var(--text, #f0f0f0) !important;
    border-color: var(--border, #2a2a3e) !important;
}

/* Social post dropdown dark */
.post-dropdown-menu {
    background: var(--bg-card, #1a1a2e) !important;
    border-color: var(--border, #2a2a3e) !important;
}
.post-dropdown-menu div:hover {
    background: var(--bg-card-alt, #1e1e3a) !important;
}

/* Reaction picker dark */
.reaction-picker-popup {
    background: var(--bg-card, #1a1a2e) !important;
    border-color: var(--border, #2a2a3e) !important;
}

/* Sticker/GIF panel dark */
.sticker-gif-panel {
    background: var(--bg-card, #1a1a2e) !important;
    border-color: var(--border, #2a2a3e) !important;
    color: var(--text, #f0f0f0) !important;
}

/* Attach menu dark */
.attach-menu-popup {
    background: var(--bg-card, #1a1a2e) !important;
    border-color: var(--border, #2a2a3e) !important;
    color: var(--text, #f0f0f0) !important;
}

/* Chat menu dark */
.chat-menu-dropdown {
    background: var(--bg-card, #1a1a2e) !important;
    border-color: var(--border, #2a2a3e) !important;
}
.chat-menu-item {
    color: var(--text, #f0f0f0) !important;
}
.chat-menu-item:hover {
    background: var(--bg-card-alt, #1e1e3a) !important;
}

/* Friend request item dark */
.friend-request-item {
    border-color: var(--border, #2a2a3e) !important;
}

/* Group info panel dark */
.group-info-panel {
    background: var(--bg-card, #1a1a2e) !important;
    color: var(--text, #f0f0f0) !important;
    border-color: var(--border, #2a2a3e) !important;
}

/* Msg bubble colors fix for dark */
.msg-actions-bar {
    background: var(--bg-card, #1a1a2e) !important;
    border-color: var(--border, #2a2a3e) !important;
}

/* Reply preview bar dark */
.reply-preview-bar {
    background: var(--bg-card-alt, #1e1e3a) !important;
    border-color: var(--gold, #D4AF37) !important;
    color: var(--text, #f0f0f0) !important;
}

/* Pinned message dark */
.pinned-message-banner {
    background: var(--bg-card-alt, #1e1e3a) !important;
    border-color: var(--gold, #D4AF37) !important;
    color: var(--text, #f0f0f0) !important;
}

/* Dashboard shortcuts dark */
.dash-shortcut-btn {
    background: var(--bg-card-alt, #1e1e3a) !important;
    color: var(--text, #f0f0f0) !important;
    border-color: var(--border, #2a2a3e) !important;
}

/* Tab buttons dark */
.tab-btn {
    background: var(--bg-card-alt, #1e1e3a) !important;
    color: var(--text, #f0f0f0) !important;
    border-color: var(--border, #2a2a3e) !important;
}
.tab-btn.active {
    background: var(--gold, #D4AF37) !important;
    color: #000 !important;
    border-color: var(--gold, #D4AF37) !important;
}

/* Scrollbar dark */

/* Contact/chat item border dark */
.contact-item, .chat-item {
    border-color: var(--border, #2a2a3e) !important;
}

/* System message dark */

/* AI Assistant dark */
.ai-input-bar {
    background: var(--bg-card, #1a1a2e) !important;
    border-color: var(--border, #2a2a3e) !important;
}
.ai-bubble-bot {
    background: var(--bg-card-alt, #1e1e3a) !important;
    color: var(--text, #f0f0f0) !important;
}
.ai-quick-card {
    background: var(--bg-card-alt, #1e1e3a) !important;
    color: var(--text, #f0f0f0) !important;
    border-color: var(--border, #2a2a3e) !important;
}

/* Date separator dark */
.date-separator span {
    background: var(--bg-card, #1a1a2e) !important;
    color: var(--text-muted, #888) !important;
}

/* Message highlight dark */
.msg-highlight {
    background: rgba(212, 175, 55, 0.3) !important;
}

/* Msg reaction chip dark */
.msg-reaction-chip {
    background: var(--bg-card-alt, #1e1e3a) !important;
    border-color: var(--border, #2a2a3e) !important;
    color: var(--text, #f0f0f0) !important;
}

/* ===== GLOBAL DARK MODE CLEANUP ===== */

/* Ensure all system messages are dark */
.system-message {
    background: rgba(255,255,255,0.05) !important;
    color: var(--text-muted) !important;
}

/* Sidebar dark */
.sidebar {
    background: var(--bg-card) !important;
}
.sidebar .nav-item:hover {
    background: var(--bg-card-alt) !important;
    color: var(--gold) !important;
}
.sidebar .nav-item.active {
    background: rgba(212,175,55,0.1) !important;
    border-left: 3px solid var(--gold) !important;
    color: var(--gold) !important;
}

/* Bottom tab active gold */
.bottom-tab-item.active {
    color: var(--gold) !important;
}

/* Tables dark */
table, th, td {
    border-color: var(--border) !important;
    color: var(--text);
}
th {
    background: var(--bg-card-alt) !important;
}
td {
    background: var(--bg-card) !important;
}

/* Scrollbar dark */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Selection */
::selection {
    background: rgba(212,175,55,0.3);
    color: var(--text);
}


