:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #eab308;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --radius: 8px;
}

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

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, #0f172a, #1e3a5f);
}
.login-card {
    background: var(--surface);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
}
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card p { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }
.login-card input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--primary); }
.login-card button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}
.login-card button:hover { background: var(--primary-hover); }
.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.logo { font-weight: 800; font-size: 18px; color: var(--primary); }
.separator { color: var(--text-muted); }
.title { font-size: 16px; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 12px; }
.search-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    width: 200px;
}
.user-name { color: var(--text-muted); font-size: 13px; }

.btn-primary {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-ghost:hover { background: var(--surface-light); }
.btn-danger {
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    background: var(--danger);
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-danger:hover { opacity: 0.85; }

/* Kanban board */
.kanban-board {
    display: flex;
    gap: 16px;
    padding: 20px;
    overflow-x: auto;
    min-height: calc(100vh - 60px);
}
.kanban-column {
    flex: 1;
    min-width: 280px;
    max-width: 360px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
}
.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 14px;
}
.column-count {
    background: var(--surface-light);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
.column-body {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 100px;
}
.column-body.drag-over {
    background: rgba(59, 130, 246, 0.08);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
}

/* Card */
.kanban-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: border-color 0.2s, transform 0.1s;
}
.kanban-card:hover { border-color: var(--primary); }
.kanban-card:active { cursor: grabbing; transform: rotate(1deg); }
.kanban-card.dragging { opacity: 0.4; }

.card-title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.card-excerpt { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}
.priority-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}
.priority-haute { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.priority-moyenne { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.priority-basse { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.card-category { color: var(--text-muted); }
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag {
    background: var(--surface-light);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 10px;
    color: var(--text-muted);
}

/* Card meta (content badge + published link) */
.card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.content-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    white-space: nowrap;
    cursor: help;
}
.card-published-link {
    font-size: 11px;
    color: #4ade80;
    text-decoration: none;
    white-space: nowrap;
}
.card-published-link:hover { text-decoration: underline; }
.card-platform {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
}

/* Content preview in modal */
.content-preview {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text);
}
.content-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.content-preview-toggle {
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    background: none;
    border: none;
}
.content-preview-toggle:hover { text-decoration: underline; }
.published-link-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius);
    margin-top: 8px;
}
.published-link-box a {
    color: #4ade80;
    text-decoration: none;
    font-size: 13px;
    word-break: break-all;
}
.published-link-box a:hover { text-decoration: underline; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal {
    background: var(--surface);
    border-radius: 12px;
    width: 700px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.modal-close:hover { background: var(--surface-light); }
.modal-body { padding: 24px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.form-row input, .form-row textarea, .form-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
    outline: none;
    border-color: var(--primary);
}
.form-row-2 { display: flex; gap: 12px; margin-bottom: 16px; }
.form-row-2 > div { flex: 1; }
.form-row-2 label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.form-row-2 input, .form-row-2 select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}
.form-row-2 input:focus, .form-row-2 select:focus { outline: none; border-color: var(--primary); }
.modal-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.spacer { flex: 1; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--surface-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Responsive */
@media (max-width: 768px) {
    .kanban-board { flex-direction: column; }
    .kanban-column { max-width: 100%; }
    .header-right { flex-wrap: wrap; gap: 8px; }
    .search-input { width: 120px; }
    .form-row-2 { flex-direction: column; }
    .modal { width: 100%; border-radius: 0; }
}

/* Multiselect dropdown for tags */
.multiselect-dropdown {
    position: relative;
    width: 100%;
}
.multiselect-field {
    min-height: 42px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-light);
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    transition: border-color 0.15s;
}
.multiselect-field:hover {
    border-color: var(--primary);
}
.multiselect-placeholder {
    color: var(--text-muted);
    font-size: 14px;
}
.multiselect-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}
.chip-remove {
    cursor: pointer;
    opacity: 0.6;
    font-size: 10px;
}
.chip-remove:hover {
    opacity: 1;
}
.multiselect-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    margin-top: 4px;
}
.multiselect-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.1s;
}
.multiselect-option:hover {
    background: var(--surface-light);
}
.multiselect-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.tag-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
