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

:root {
    --bg: #1a1a2e;
    --bg2: #16213e;
    --bg3: #0f3460;
    --text: #e0e0e0;
    --text2: #a0a0b0;
    --accent: #e94560;
    --accent2: #533483;
    --border: #2a2a4a;
    --success: #4caf50;
    --danger: #e94560;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Login */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg), var(--bg2));
}

.login-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 360px;
    text-align: center;
}

.login-card h1 { font-size: 28px; margin-bottom: 4px; }
.login-subtitle { color: var(--text2); margin-bottom: 24px; font-size: 14px; }

.login-card input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.login-card input:focus { border-color: var(--accent); }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; }
.hidden { display: none !important; }

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Layout */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
}

.sidebar-logo {
    font-size: 20px;
    font-weight: 700;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
}

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

.nav-item {
    display: block;
    padding: 10px 20px;
    color: var(--text2);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-item.active { color: var(--accent); background: rgba(233,69,96,0.1); border-right: 3px solid var(--accent); }

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}
.sidebar-footer a { color: var(--text2); text-decoration: none; font-size: 13px; }

.content {
    flex: 1;
    margin-left: 220px;
    padding: 24px 32px;
}

/* Sections */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.section-header h2 { font-size: 22px; }

/* Items list */
.items-list { display: flex; flex-direction: column; gap: 8px; }

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.list-item-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg3);
}
.list-item-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.list-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.list-item-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item > .list-item-name { flex: 1; }
.list-item-meta { color: var(--text2); font-size: 13px; }
.list-item-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Filter bar */
.filter-bar {
    margin-bottom: 16px;
}
.filter-bar select {
    padding: 8px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    font-size: 14px;
    outline: none;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 6px;
    font-weight: 500;
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    color: var(--text2);
    cursor: pointer;
    transition: all 0.2s;
}
.dropzone.dragover { border-color: var(--accent); background: rgba(233,69,96,0.05); }
.file-label { color: var(--accent); cursor: pointer; text-decoration: underline; }

/* Media preview */
.media-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.media-thumb {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 2px solid var(--border);
    cursor: grab;
}
.media-thumb.is-cover { border-color: var(--accent); }
.media-thumb img,
.media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.media-thumb-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
}
.media-thumb-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
}
.media-cover-btn { background: rgba(0,0,0,0.6); color: #fff; }
.media-cover-btn.active { background: var(--accent); }
.media-del-btn { background: rgba(0,0,0,0.6); color: #fff; }

/* Post editor */
.post-editor {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.post-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}
.tb-btn {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
}
.tb-btn:hover { border-color: var(--accent); }

.post-editor textarea {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    resize: vertical;
}

.post-media-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}
.post-media-row span { color: var(--text2); font-size: 13px; }

.post-preview-label { font-size: 13px; color: var(--text2); margin-bottom: 8px; }
.post-preview {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 60px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Emoji picker */
.emoji-picker {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    max-width: 420px;
}
.emoji-tabs {
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    padding: 4px 4px 0;
    gap: 2px;
}
.emoji-tab {
    padding: 6px 8px;
    font-size: 18px;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    border-radius: 4px 4px 0 0;
    flex-shrink: 0;
}
.emoji-tab:hover { background: rgba(255,255,255,0.05); }
.emoji-tab.active { border-bottom-color: var(--accent); background: rgba(233,69,96,0.1); }
.emoji-panels {
    padding: 8px;
    max-height: 240px;
    overflow-y: auto;
}
.emoji-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}
.emoji-panel span {
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.15s;
}
.emoji-panel span:hover { background: rgba(255,255,255,0.1); }

/* Post history items */
.post-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
}
.post-item-thumb {
    width: 64px;
    height: 64px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg3);
}
.post-item-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.post-item-body {
    flex: 1;
    min-width: 0;
}
.post-item-date {
    font-size: 12px;
    color: var(--text2);
    margin-bottom: 4px;
}
.post-item-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.post-item-actions {
    flex-shrink: 0;
    align-self: center;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}
.modal-box {
    position: relative;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    min-width: 320px;
    max-width: 480px;
}
.modal-box h3 { margin-bottom: 16px; }
.modal-box input {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    outline: none;
    margin-bottom: 12px;
}
.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 14px;
    z-index: 2000;
    animation: fadeIn 0.3s;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar-logo { font-size: 14px; padding: 0 8px 16px; }
    .nav-item { padding: 10px 8px; font-size: 18px; text-align: center; }
    .sidebar-footer { padding: 8px; text-align: center; }
    .content { margin-left: 60px; padding: 16px; }
}
