/* ============================================================
   Hypnose YouTube Admin — Global Styles
   ============================================================ */

:root {
    --bg:        #0f172a;
    --bg-2:      #1e293b;
    --bg-3:      #334155;
    --surface:   #1e293b;
    --surface-2: #273449;
    --border:    #334155;
    --text:      #f1f5f9;
    --text-muted:#94a3b8;
    --primary:   #6366f1;
    --primary-2: #818cf8;
    --accent:    #ec4899;
    --success:   #22c55e;
    --warning:   #f59e0b;
    --danger:    #ef4444;
    --info:      #3b82f6;
    --members:   #fbbf24;
    --auto:      #22c55e;
    --manual:    #f97316;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; font-size: 14px; }
body { opacity: 0; transition: opacity .25s; }
body.app-loaded { opacity: 1; }

a { color: var(--primary-2); text-decoration: none; }
a:hover { color: var(--primary); }
code { background: var(--bg-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* ============================================================ */
/* Buttons                                                       */
/* ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
    background: var(--bg-3); color: var(--text); font-weight: 500; font-size: 13px;
    cursor: pointer; transition: all .15s;
    font-family: inherit;
}
.btn:hover  { background: var(--surface-2); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-success  { background: var(--success); color: #052e0e; }
.btn-warning  { background: var(--warning); color: #422006; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-ghost    { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-2); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================ */
/* Inputs                                                        */
/* ============================================================ */
input, select, textarea {
    background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
    padding: 8px 12px; border-radius: 6px; font-size: 13px; font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
textarea { resize: vertical; min-height: 80px; }
label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }

input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; vertical-align: middle; }

.form-row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.form-row > * { flex: 1 1 180px; min-width: 0; }

.field { margin-bottom: 14px; }
.field input, .field select, .field textarea { width: 100%; }

/* ============================================================ */
/* App Shell                                                     */
/* ============================================================ */
#app-root { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
    display: flex; align-items: center; gap: 18px;
    padding: 8px 18px; background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.app-title { margin: 0; font-size: 16px; }
.app-tabs { flex: 1; display: flex; gap: 2px; overflow-x: auto; }
.app-user { color: var(--text-muted); font-size: 13px; }
.app-header-right { display: flex; align-items: center; gap: 8px; }

.tab-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent; color: var(--text-muted);
    padding: 8px 12px; border: none; border-radius: 6px;
    font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
    transition: all .15s;
}
.tab-btn:hover { background: var(--bg-3); color: var(--text); }
.tab-btn.active { background: var(--primary); color: #fff; }
.tab-icon { font-size: 14px; }

.app-main { flex: 1; padding: 24px; max-width: 1600px; margin: 0 auto; width: 100%; }
.module { animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.loading-state, .error-state, .empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.error-state { color: var(--danger); }

/* ============================================================ */
/* Login                                                         */
/* ============================================================ */
.login-screen {
    min-height: 100vh; display: grid; place-items: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
}
.login-card {
    background: var(--surface); border: 1px solid var(--border);
    padding: 40px; border-radius: 16px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-sub { margin: 0 0 24px; color: var(--text-muted); font-size: 13px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card input { padding: 12px; }
.login-hint { margin-top: 14px; font-size: 11px; color: var(--text-muted); text-align: center; }

/* ============================================================ */
/* Cards                                                         */
/* ============================================================ */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 16px; margin-bottom: 14px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--border); padding: 16px; border-radius: 10px; }
.kpi-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.kpi-value { font-size: 28px; font-weight: 700; }
.kpi-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================ */
/* Tables                                                        */
/* ============================================================ */
.data-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--bg-2); font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: var(--bg-2); }
.data-table .row-actions { display: flex; gap: 4px; }

/* ============================================================ */
/* Badges                                                        */
/* ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600;
    background: var(--bg-3); color: var(--text);
}
.badge-success { background: rgba(34,197,94,.18);  color: #86efac; }
.badge-warning { background: rgba(245,158,11,.18); color: #fbbf24; }
.badge-danger  { background: rgba(239,68,68,.18); color: #fca5a5; }
.badge-info    { background: rgba(59,130,246,.18); color: #93c5fd; }
.badge-members { background: rgba(251,191,36,.22); color: #fbbf24; }
.badge-auto    { background: rgba(34,197,94,.18); color: #86efac; }
.badge-manual  { background: rgba(249,115,22,.18); color: #fdba74; }
.badge-ghost   { background: var(--bg-2); color: var(--text-muted); }

/* Status-Farben Videos */
.status-idee          { background: rgba(148,163,184,.18); color: #cbd5e1; }
.status-skript        { background: rgba(99,102,241,.18); color: #a5b4fc; }
.status-produktion    { background: rgba(245,158,11,.18); color: #fbbf24; }
.status-schnitt       { background: rgba(236,72,153,.18); color: #f9a8d4; }
.status-geplant       { background: rgba(59,130,246,.18); color: #93c5fd; }
.status-veroeffentlicht { background: rgba(34,197,94,.18); color: #86efac; }
.status-verworfen     { background: rgba(239,68,68,.18); color: #fca5a5; }

/* ============================================================ */
/* Modal + Confirm                                               */
/* ============================================================ */
.modal-overlay, .confirm-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: grid; place-items: center; z-index: 100; padding: 20px;
    animation: fadeIn .15s;
}
.modal {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    width: 100%; max-width: 600px; max-height: 90vh;
    display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-sm { max-width: 400px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1200px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { margin: 0; font-size: 16px; }
.modal-close { background: transparent; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; line-height: 1; padding: 0; width: 28px; height: 28px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

.confirm-dialog {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 24px; max-width: 400px;
}
.confirm-title { margin: 0 0 8px; font-size: 16px; }
.confirm-message { margin: 0 0 18px; color: var(--text-muted); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================================ */
/* Notifications                                                 */
/* ============================================================ */
#notifications-container { position: fixed; top: 70px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; border-radius: 8px; color: #fff; font-size: 13px;
    min-width: 240px; max-width: 360px; cursor: pointer;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    transform: translateX(120%); transition: transform .25s, opacity .25s;
}
.toast-in { transform: translateX(0); }
.toast-out { opacity: 0; }
.toast-icon { width: 18px; height: 18px; background: rgba(0,0,0,.25); border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; }

/* ============================================================ */
/* Calendar                                                      */
/* ============================================================ */
.cal-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-month-label { font-size: 18px; font-weight: 700; min-width: 200px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { background: var(--bg-2); padding: 8px; text-align: center; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.cal-cell { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; min-height: 110px; padding: 6px; position: relative; cursor: pointer; transition: background .15s; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.cal-other { opacity: .35; }
.cal-cell.cal-today { border-color: var(--primary); }
.cal-day-num { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.cal-today .cal-day-num { color: var(--primary-2); font-weight: 700; }
.cal-event {
    font-size: 11px; padding: 3px 6px; border-radius: 4px; margin-bottom: 2px;
    background: var(--primary); color: #fff;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    display: flex; align-items: center; gap: 4px;
}
.cal-event-icon { font-size: 9px; }

/* ============================================================ */
/* AI Chat                                                       */
/* ============================================================ */
.ai-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; height: calc(100vh - 140px); }
.ai-sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow-y: auto; }
.ai-mode-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.ai-mode-btn { text-align: left; padding: 8px 12px; background: transparent; color: var(--text-muted); border: none; border-radius: 6px; cursor: pointer; }
.ai-mode-btn:hover { background: var(--bg-2); color: var(--text); }
.ai-mode-btn.active { background: var(--primary); color: #fff; }
.ai-chat-list { display: flex; flex-direction: column; gap: 2px; }
.ai-chat-item { padding: 6px 10px; font-size: 12px; color: var(--text-muted); border-radius: 4px; cursor: pointer; }
.ai-chat-item:hover { background: var(--bg-2); color: var(--text); }
.ai-chat-item.active { background: var(--bg-3); color: var(--text); }

.ai-main { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ai-messages { flex: 1; padding: 16px; overflow-y: auto; }
.ai-msg { margin-bottom: 16px; max-width: 85%; }
.ai-msg.user { margin-left: auto; }
.ai-msg-role { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.ai-msg-bubble { padding: 12px 16px; border-radius: 10px; line-height: 1.5; font-size: 13px; white-space: pre-wrap; word-wrap: break-word; }
.ai-msg.user .ai-msg-bubble { background: var(--primary); color: #fff; }
.ai-msg.assistant .ai-msg-bubble { background: var(--bg-2); }
.ai-msg-meta { font-size: 10px; color: var(--text-muted); margin-top: 4px; }
.ai-input-bar { padding: 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: end; }
.ai-input-bar textarea { flex: 1; min-height: 44px; max-height: 200px; }
.ai-toolbar { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border); align-items: center; flex-wrap: wrap; }

/* ============================================================ */
/* Markdown Editor                                               */
/* ============================================================ */
.md-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; height: 70vh; }
.md-editor textarea { width: 100%; height: 100%; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; line-height: 1.6; }
.md-preview { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 16px; overflow-y: auto; }
.md-preview h1, .md-preview h2, .md-preview h3 { margin-top: 16px; margin-bottom: 8px; }
.md-preview pre { background: var(--bg); padding: 8px; border-radius: 4px; overflow-x: auto; }
.md-preview code { font-size: 12px; }
.md-preview p { line-height: 1.6; }

/* ============================================================ */
/* Skits Grid                                                    */
/* ============================================================ */
.skits-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.skit-card { background: var(--surface); border: 1px solid var(--border); padding: 14px; border-radius: 8px; cursor: pointer; transition: all .15s; }
.skit-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.skit-card h4 { margin: 0 0 6px; font-size: 14px; }
.skit-card .skit-meta { font-size: 11px; color: var(--text-muted); }

/* ============================================================ */
/* Misc                                                          */
/* ============================================================ */
.row { display: flex; gap: 12px; align-items: center; }
.row-spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 12px; }
.text-right { text-align: right; }
.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; }

.color-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Schmale Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 768px) {
    .app-main { padding: 12px; }
    .tab-label { display: none; }
    .ai-layout { grid-template-columns: 1fr; height: auto; }
    .md-editor { grid-template-columns: 1fr; height: auto; }
}
