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

:root {
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --bg-hover: #f1f5f9;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --border: #e2e8f0;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* font-size is set dynamically via header.php based on user preference */
body {
    font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Noto Sans JP", -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === TOP TAB BAR === */
.top-tab-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 44px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: stretch;
    z-index: 150;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.top-tab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 18px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s;
}
.top-tab-item:hover { color: var(--text); text-decoration: none; }
.top-tab-item.active { color: var(--accent-hover); }
.top-tab-item.active::after {
    content: "";
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 28px; height: 3px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
}
.top-tab-item i { font-size: 16px; }

/* === LAYOUT === */
.app-layout { display: flex; min-height: 100vh; padding-top: 44px; }

.sidebar {
    width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 44px; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 20px;
    font-size: 22px;
    font-weight: 800;
    color: var(--accent-hover);
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.5px;
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    position: relative;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active { color: var(--accent-hover); background: rgba(99,102,241,0.1); }
.nav-item .nav-icon { font-size: 20px; display: flex; align-items: center; justify-content: center; width: 36px; min-width: 36px; height: 36px; }
.nav-badge {
    position: absolute; right: 16px;
    background: var(--danger); color: #fff;
    font-size: 11px; font-weight: 700;
    padding: 1px 7px; border-radius: 10px;
    min-width: 20px; text-align: center;
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
}
.sidebar-user img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-handle { font-size: 12px; color: var(--text-dim); }

.main-content { flex: 1; margin-left: 240px; min-height: 100vh; }
.content-area { max-width: 680px; margin: 0 auto; padding: 24px 16px; }
.content-wide { max-width: 960px; margin: 0 auto; padding: 24px 16px; }

/* === PAGE HEADER === */
.page-header { padding: 20px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.page-header h1 { font-size: 24px; font-weight: 700; }

/* === CARDS === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

/* === BUTTONS === */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border: none; border-radius: var(--radius-xs);
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 0.2s; text-decoration: none; white-space: nowrap; line-height: 1.4;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: var(--bg-input); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === FORMS === */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-input {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-xs); color: var(--text);
    font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99,102,241,0.3); }
.form-input::placeholder { color: var(--text-dim); }
textarea.form-input { resize: vertical; min-height: 80px; }

/* === AVATAR === */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--bg-input); }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--bg-input); }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--bg-input); }
.avatar-xl { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: var(--bg-input); }

/* === ALERT === */
.alert { padding: 12px 16px; border-radius: var(--radius-xs); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* === POST CARD === */
.post-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 20px; margin-bottom: 12px;
}
.post-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-user-info { flex: 1; }
.post-user-name { font-weight: 600; font-size: 14px; }
.post-user-name a { color: var(--text); }
.post-time { font-size: 12px; color: var(--text-dim); }
.post-content { font-size: 15px; line-height: 1.7; margin-bottom: 12px; word-break: break-word; }
.post-content .hashtag { color: var(--accent-hover); }
.post-images { margin-bottom: 12px; border-radius: var(--radius-sm); overflow: hidden; }
.post-images img { width: 100%; display: block; }
.post-images.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.post-images.grid-3 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.post-images.grid-4 { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; }
.post-actions { display: flex; gap: 4px; border-top: 1px solid var(--border); padding-top: 10px; }
.post-action-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border: none; background: transparent;
    color: var(--text-dim); font-size: 13px; cursor: pointer;
    border-radius: var(--radius-xs); transition: all 0.2s;
}
.post-action-btn:hover { background: var(--bg-hover); color: var(--text); }
.post-action-btn.liked { color: var(--danger); }
.post-action-btn .count { font-weight: 600; }

/* === COMPOSER === */
.composer {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin-bottom: 20px;
}
.composer-top { display: flex; gap: 10px; }
.composer textarea {
    flex: 1; background: transparent; border: none; color: var(--text);
    font-size: 15px; resize: none; outline: none; min-height: 60px;
    font-family: inherit; line-height: 1.6;
}
.composer textarea::placeholder { color: var(--text-dim); }
.composer-actions {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.composer-tools { display: flex; gap: 8px; }
.composer-tool-btn {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border: none; background: transparent; color: var(--text-dim);
    font-size: 18px; cursor: pointer; border-radius: 50%; transition: all 0.2s;
}
.composer-tool-btn:hover { background: var(--bg-hover); color: var(--accent-hover); }

/* === MOBILE BOTTOM NAV === */
.mobile-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg-card); border-top: 1px solid var(--border);
    z-index: 200; padding: 6px 0 env(safe-area-inset-bottom, 6px);
}
.mobile-nav-inner { display: flex; justify-content: space-around; align-items: center; }
.mobile-nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 12px; color: var(--text-dim); font-size: 10px;
    text-decoration: none; position: relative;
}
.mobile-nav-item .nav-icon { font-size: 22px; }
.mobile-nav-item.active { color: var(--accent-hover); }
.mobile-nav-item .nav-badge { position: absolute; top: 0; right: 4px; font-size: 10px; padding: 0 5px; min-width: 16px; }

/* === AUTH PAGES === */
.auth-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow);
}
.auth-logo { font-size: 32px; font-weight: 800; color: var(--accent-hover); text-align: center; margin-bottom: 8px; letter-spacing: -1px; }
.auth-subtitle { text-align: center; color: var(--text-dim); margin-bottom: 28px; font-size: 14px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-dim); }

/* === CHAT === */
.chat-layout { display: flex; height: calc(100vh - 44px); }
.chat-sidebar {
    width: 320px; background: var(--bg-card); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; overflow: hidden;
}
.chat-sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 18px; }
.chat-thread-list { flex: 1; overflow-y: auto; }
.chat-thread-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; cursor: pointer; transition: background 0.2s;
    border-bottom: 1px solid var(--border);
}
.chat-thread-item:hover, .chat-thread-item.active { background: var(--bg-hover); }
.chat-thread-info { flex: 1; min-width: 0; }
.chat-thread-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread-last { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread-time { font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.chat-thread-unread { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }

.chat-main { flex: 1; display: flex; flex-direction: column; }
.chat-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; background: var(--bg-card); }
.chat-header-name { font-weight: 600; font-size: 16px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }

.chat-bubble {
    max-width: 70%; padding: 10px 14px; border-radius: 16px;
    font-size: 14px; line-height: 1.5; word-break: break-word; position: relative;
}
.chat-bubble.sent {
    align-self: flex-end; background: #00C300; color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-bubble.received {
    align-self: flex-start; background: var(--bg-input); color: var(--text);
    border-bottom-left-radius: 4px;
}
.chat-bubble-time { font-size: 10px; color: rgba(255,255,255,0.6); margin-top: 4px; text-align: right; }
.chat-bubble.received .chat-bubble-time { color: var(--text-dim); }
.chat-bubble-sender { font-size: 11px; color: var(--accent-hover); margin-bottom: 2px; font-weight: 600; }

/* Chat date separator */
.chat-date-separator {
    display: flex; align-items: center; justify-content: center;
    padding: 12px 0; gap: 12px;
}
.chat-date-separator::before,
.chat-date-separator::after {
    content: ""; flex: 1; height: 1px; background: var(--border);
}
.chat-date-separator span {
    font-size: 11px; color: var(--text-dim); background: var(--bg);
    padding: 2px 12px; border-radius: 12px; white-space: nowrap;
}

.chat-input-area {
    padding: 12px 16px; border-top: 1px solid var(--border);
    display: flex; gap: 10px; align-items: flex-end; background: var(--bg-card);
}
.chat-input-area textarea {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 20px; padding: 10px 16px; color: var(--text);
    font-size: 14px; font-family: inherit; resize: none; outline: none;
    max-height: 120px; min-height: 40px; line-height: 1.4;
}
.chat-input-area textarea:focus { border-color: var(--accent); }
.chat-send-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--accent); color: #fff; border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 16px; transition: background 0.2s; flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--accent-hover); }

/* === PHOTO GRID === */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.photo-grid-item { position: relative; padding-bottom: 100%; overflow: hidden; cursor: pointer; }
.photo-grid-item img {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; transition: transform 0.3s;
}
.photo-grid-item:hover img { transform: scale(1.05); }

/* === FILE MANAGER === */
.file-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.file-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    transition: background 0.2s; cursor: pointer;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--bg-hover); }
.file-icon { font-size: 24px; width: 32px; text-align: center; color: var(--text-dim); }
.file-icon.folder { color: var(--warning); }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12px; color: var(--text-dim); }
.file-actions { display: flex; gap: 6px; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .sidebar { width: 200px; }
    .main-content { margin-left: 200px; }
    .chat-sidebar { width: 280px; }
}

@media (max-width: 768px) {
    .top-tab-item span { display: none; }
    .top-tab-item { padding: 0 12px; }
    .top-tab-item i { font-size: 20px; }
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding-bottom: 70px; }
    .mobile-nav { display: block; }
    .content-area, .content-wide { padding: 16px 12px; }
    .auth-card { padding: 28px 20px; }
    .page-header h1 { font-size: 20px; }
    .card { padding: 14px; margin-bottom: 12px; }
    .chat-bubble { max-width: 85%; }
    .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 2px; }
    .post-card { padding: 14px; }
    .post-images.grid-2,
    .post-images.grid-3,
    .post-images.grid-4 { grid-template-columns: 1fr 1fr; }
    /* Chat mobile: use chat-open toggle */
    .chat-layout { height: calc(100vh - 44px - 60px); }
    .chat-sidebar { width: 100%; flex: 1; }
    .chat-main { display: none; }
    .chat-layout.chat-open .chat-sidebar { display: none !important; }
    .chat-layout.chat-open .chat-main { display: flex !important; flex: 1; }
}

@media (max-width: 480px) {
    .top-tab-bar { height: 40px; }
    .app-layout { padding-top: 40px; }
    .content-area, .content-wide { padding: 12px 8px; }
    .photo-grid { grid-template-columns: repeat(2, 1fr); }
    .btn { padding: 8px 14px; font-size: 13px; }
    .btn-sm { padding: 5px 10px; font-size: 12px; }
    .chat-bubble { max-width: 90%; font-size: 13px; }
    .avatar { width: 36px; height: 36px; }
    .avatar-lg { width: 56px; height: 56px; }
    .avatar-xl { width: 80px; height: 80px; }
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* === TRANSITIONS === */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* === UTILITIES === */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent-hover); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none !important; }

/* === DARK MODE === */
html[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --bg-hover: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border: #334155;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}
html[data-theme="dark"] .chat-bubble.received { background: #334155; }
html[data-theme="dark"] .chat-date-separator span { background: #1e293b; }
html[data-theme="dark"] img { opacity: 0.95; }
html[data-theme="dark"] .alert-error { background: #451a1a; color: #fca5a5; border-color: #7f1d1d; }
html[data-theme="dark"] .alert-success { background: #14532d; color: #86efac; border-color: #166534; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: #1e293b; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* === LIGHTBOX GLOBAL === */
.lightbox-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.92);
    z-index: 500; display: flex; align-items: center; justify-content: center;
}
.lightbox-overlay img { max-width: 90vw; max-height: 85vh; object-fit: contain; border-radius: 4px; }

/* === BADGE === */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 10px;
    font-size: 11px; font-weight: 600; line-height: 1.4;
}

/* === LOADING SPINNER === */
.spinner {
    width: 24px; height: 24px; border: 3px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.6s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === TOAST === */
#toastContainer {
    position: fixed; top: 56px; right: 16px; z-index: 600;
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
.toast-item {
    pointer-events: auto;
    padding: 12px 20px; border-radius: 8px;
    font-size: 14px; font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease;
    max-width: 360px;
}
.toast-success { background: #22c55e; color: white; }
.toast-error { background: #ef4444; color: white; }
.toast-warning { background: #f59e0b; color: white; }
.toast-info { background: #3b82f6; color: white; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }

/* === INSTAGRAM-STYLE PHOTOS === */

/* Tabs */
.ig-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 12px 20px; background: transparent; border: none;
    color: var(--text-muted); font-size: 13px; font-weight: 600;
    cursor: pointer; position: relative; text-decoration: none;
    transition: color 0.2s;
}
.ig-tab:hover { color: var(--text); text-decoration: none; }
.ig-tab.active { color: var(--text); }
.ig-tab.active::after {
    content: ""; position: absolute; bottom: -1px; left: 0; right: 0;
    height: 2px; background: var(--text);
}

/* Grid */
.ig-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
}
.ig-grid-item {
    position: relative; padding-bottom: 100%; overflow: hidden; cursor: pointer;
    background: var(--bg-input);
}
.ig-grid-item img {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    object-fit: cover; transition: transform 0.3s;
}
.ig-grid-item:hover img { transform: scale(1.05); }
.ig-grid-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center; gap: 16px;
    color: white; font-weight: 700; font-size: 14px;
    opacity: 0; transition: opacity 0.2s;
}
.ig-grid-item:hover .ig-grid-overlay { opacity: 1; }

/* Upload Modal */
.ig-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    z-index: 500; display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.ig-modal {
    background: var(--bg-card); border-radius: var(--radius);
    overflow: hidden; position: relative;
    max-height: 90vh; display: flex; flex-direction: column;
}
.ig-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    font-weight: 700;
}
.ig-modal-close {
    background: none; border: none; color: var(--text); font-size: 20px;
    cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.ig-modal-close:hover { background: var(--bg-hover); }

.ig-upload-modal { width: 90vw; max-width: 900px; }
.ig-upload-body { flex: 1; overflow-y: auto; }
.ig-upload-step { padding: 40px; }
.ig-upload-dropzone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 60px 20px; text-align: center; transition: border-color 0.2s;
}
.ig-upload-preview-area {
    display: flex; min-height: 400px;
}
.ig-upload-preview {
    flex: 1; background: #000; display: flex; align-items: center; justify-content: center;
    min-width: 0;
}
.ig-upload-preview img {
    max-width: 100%; max-height: 450px; object-fit: contain;
}
.ig-upload-sidebar {
    width: 280px; padding: 16px; border-left: 1px solid var(--border);
    overflow-y: auto;
}

/* Filter thumbnails */
.ig-filter-list {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.ig-filter-item {
    cursor: pointer; text-align: center; border-radius: var(--radius-xs);
    padding: 6px; transition: background 0.2s; border: 2px solid transparent;
}
.ig-filter-item:hover { background: var(--bg-hover); }
.ig-filter-item.active { border-color: var(--accent); background: rgba(99,102,241,0.1); }
.ig-filter-thumb {
    width: 100%; padding-bottom: 100%; position: relative;
    border-radius: 4px; overflow: hidden; margin-bottom: 4px;
}
.ig-filter-thumb img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.ig-filter-item span { font-size: 10px; color: var(--text-muted); }

/* Detail Modal */
.ig-detail-modal { width: 90vw; max-width: 1000px; max-height: 85vh; }
.ig-detail-layout { display: flex; height: 100%; min-height: 400px; }
.ig-detail-image {
    flex: 1; background: #000; display: flex; align-items: center; justify-content: center;
    min-width: 0;
}
.ig-detail-image img { max-width: 100%; max-height: 75vh; object-fit: contain; }
.ig-detail-sidebar {
    width: 340px; display: flex; flex-direction: column;
    border-left: 1px solid var(--border);
}
.ig-detail-header { flex-shrink: 0; }
.ig-detail-comments { flex: 1; overflow-y: auto; padding: 8px 0; }
.ig-detail-actions { flex-shrink: 0; }
.ig-detail-comment-form {
    display: flex; gap: 8px; padding: 10px 16px;
    border-top: 1px solid var(--border); align-items: center;
}
.ig-detail-comment-form input { flex: 1; }

/* CSS Filters */
.ig-filter-grayscale { filter: grayscale(100%); }
.ig-filter-sepia { filter: sepia(80%); }
.ig-filter-warm { filter: saturate(1.3) hue-rotate(-10deg) brightness(1.05); }
.ig-filter-cool { filter: saturate(0.9) hue-rotate(10deg) brightness(1.05) contrast(1.05); }
.ig-filter-bright { filter: brightness(1.2) contrast(0.95); }
.ig-filter-contrast { filter: contrast(1.4) brightness(0.95); }
.ig-filter-vintage { filter: sepia(30%) saturate(1.4) contrast(1.1) brightness(0.95); }

/* Mobile responsive for IG */
@media (max-width: 768px) {
    .ig-upload-preview-area { flex-direction: column; }
    .ig-upload-sidebar { width: 100%; border-left: none; border-top: 1px solid var(--border); }
    .ig-upload-preview { min-height: 200px; }
    .ig-detail-layout { flex-direction: column; }
    .ig-detail-sidebar { width: 100%; border-left: none; border-top: 1px solid var(--border); max-height: 300px; }
    .ig-detail-image { min-height: 200px; }
    .ig-filter-list { grid-template-columns: repeat(4, 1fr); }
    .ig-grid { gap: 2px; }
}

/* Floating Action Button (FAB) */
.fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(99,102,241,0.4);
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
}
.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(99,102,241,0.5);
}
.fab:active {
    transform: scale(0.95);
}
@media (max-width: 768px) {
    .fab { bottom: 80px; right: 16px; width: 56px; height: 56px; font-size: 24px; }
}

/* Custom Nav Icon Images */
/* Custom Nav Icon Images */
.nav-icon-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
}
.top-tab-item .nav-icon-img {
    width: 30px;
    height: 30px;
}
.sidebar-nav .nav-icon-img {
    width: 34px;
    height: 34px;
}
.mobile-nav-item .nav-icon-img {
    width: 28px;
    height: 28px;
}
/* Nav icon container - flex center */
.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    height: 36px;
}

/* Page title icon */
.page-title-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    vertical-align: -2px;
    margin-right: 4px;
}
