/* ════════════════════════════════════════════════════════
   ChatConnect — Application Stylesheet
   ════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --accent: #10b981;
    --accent-dark: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;

    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-sidebar: #141722;
    --bg-input: #252836;
    --bg-hover: #2a2d3a;
    --bg-active: #2d3148;
    --bg-modal: rgba(0,0,0,.6);

    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --border: #2e3141;
    --border-light: #3b3f54;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;

    --font: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --shadow: 0 4px 24px rgba(0,0,0,.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,.5);

    --sidebar-w: 280px;
    --header-h: 56px;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ── App Root ── */
.app-root { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* ══════════════════════════════════════
   Login Page
   ══════════════════════════════════════ */

.login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1117 0%, #1e1b4b 50%, #0f1117 100%);
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.login-header { text-align: center; margin-bottom: 28px; }
.login-icon { font-size: 48px; margin-bottom: 12px; }
.login-header h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
.login-header p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.method-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.method-tab {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.method-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input-field {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: border-color .15s;
}
.input-field:focus { border-color: var(--primary); }
.input-field.input-mono { font-family: var(--font-mono); letter-spacing: 2px; font-weight: 600; }
.input-field.textarea { resize: vertical; min-height: 60px; }
.input-field.input-sm { padding: 6px 10px; font-size: 13px; }

select.input-field { cursor: pointer; }

.otp-sent-msg { color: var(--text-muted); font-size: 13px; text-align: center; margin-bottom: 16px; }
.otp-inputs { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.otp-digit {
    width: 44px; height: 52px;
    text-align: center;
    font-size: 22px; font-weight: 700;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--font-mono);
    outline: none;
    caret-color: var(--primary);
    transition: border-color .15s, box-shadow .15s;
}
.otp-digit:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); background: var(--bg-active); }

/* ── Buttons ── */
.btn-primary {
    width: 100%;
    padding: 11px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    font-family: var(--font);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
    width: 100%;
    padding: 9px 16px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
    font-family: var(--font);
}
.btn-ghost:hover { background: var(--bg-hover); }

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--text-muted); cursor: pointer; font-family: var(--font); }
.btn-sm.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-sm.btn-accent { background: var(--accent); color: white; border-color: var(--accent); }

.btn-icon { background: transparent; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); }
.btn-icon:hover { background: var(--bg-hover); }
.btn-icon-sm { background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 14px; padding: 4px; }

/* ── Alerts ── */
.alert { font-size: 13px; padding: 8px 12px; border-radius: var(--radius-sm); margin-top: 12px; }
.error-msg, .alert-error { color: var(--danger); font-size: 13px; margin-top: 12px; text-align: center; padding: 8px 12px; background: rgba(239,68,68,.08); border-radius: var(--radius-sm); }
.success-msg, .alert-success { color: var(--accent); font-size: 13px; margin-top: 12px; text-align: center; padding: 8px 12px; background: rgba(16,185,129,.08); border-radius: var(--radius-sm); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.badge-admin { background: rgba(239,68,68,.15); color: #f87171; }
.badge-manager { background: rgba(245,158,11,.15); color: #fbbf24; }
.badge-student { background: rgba(59,130,246,.15); color: #60a5fa; }
.badge-member { background: rgba(99,102,241,.12); color: var(--primary-light); }
.badge-sm { font-size: 9px; padding: 1px 6px; }

/* ══════════════════════════════════════
   Chat Layout
   ══════════════════════════════════════ */

.chat-layout { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }

.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-details { flex: 1; min-width: 0; }
.user-name { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-actions { display: flex; gap: 6px; }
.sidebar-actions .btn-sm { flex: 1; text-align: center; font-size: 11px; }

.group-list { flex: 1; overflow-y: auto; padding: 8px; }
.group-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); padding: 8px 12px 4px; }

.group-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: var(--font);
    font-size: 13px;
    transition: background .1s;
}
.group-item:hover { background: var(--bg-hover); }
.group-item.active { background: var(--bg-active); border-left: 3px solid var(--primary); }
.group-icon { font-size: 18px; flex-shrink: 0; }
.group-meta { flex: 1; min-width: 0; }
.group-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-members-count { display: block; font-size: 11px; color: var(--text-dim); }
.lock-icon { font-size: 12px; opacity: .5; }

/* ── Chat Main ── */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    height: var(--header-h);
    min-height: var(--header-h);
    border-bottom: 1px solid var(--border);
    background: var(--bg-sidebar);
}
.header-icon { font-size: 24px; }
.header-info { flex: 1; min-width: 0; }
.header-info h3 { font-size: 15px; font-weight: 600; }
.header-meta { font-size: 11px; color: var(--text-dim); }

.permission-badge {
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 500;
}
.permission-all { background: rgba(16,185,129,.12); color: #6ee7b7; }
.permission-adminonly { background: rgba(239,68,68,.12); color: #fca5a5; }
.permission-managerandabove { background: rgba(245,158,11,.12); color: #fde68a; }

/* ── Chat Body ── */
.chat-body { flex: 1; display: flex; overflow: hidden; }

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ── Message Bubble ── */
.message-bubble {
    display: flex;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius);
    position: relative;
    transition: background .1s;
}
.message-bubble.hovered { background: var(--bg-hover); }

.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-msg { margin-top: 2px; }

.message-content { flex: 1; min-width: 0; }
.message-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.message-author { font-size: 13px; font-weight: 600; }
.message-author.is-own { color: var(--primary-light); }
.message-time { font-size: 11px; color: var(--text-dim); }

.message-text { font-size: 14px; line-height: 1.55; word-break: break-word; }
.message-text.deleted { color: var(--text-dim); font-style: italic; }

.mention { color: var(--primary-light); background: rgba(99,102,241,.12); padding: 0 4px; border-radius: 3px; font-weight: 500; }

/* Reply reference */
.reply-reference {
    padding: 4px 10px;
    border-left: 3px solid var(--primary);
    background: rgba(99,102,241,.06);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 4px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.reply-author { font-weight: 600; color: var(--primary-light); }
.reply-text { color: var(--text-muted); }

/* Media attachment */
.media-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-input);
    border-radius: var(--radius);
    margin-top: 6px;
    cursor: pointer;
    border: 1px solid var(--border);
}
.media-attachment:hover { border-color: var(--primary); }
.media-icon { font-size: 24px; }
.media-info { flex: 1; min-width: 0; }
.media-name { font-size: 13px; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-size { font-size: 11px; color: var(--text-dim); }

/* Reactions */
.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    cursor: pointer;
    font-size: 13px;
    transition: all .1s;
}
.reaction-chip:hover { border-color: var(--primary); }
.reaction-chip.reacted { border-color: var(--primary); background: rgba(99,102,241,.12); }
.reaction-count { font-size: 11px; color: var(--text-muted); }

/* Message hover actions */
.message-actions {
    position: absolute;
    top: -8px;
    right: 8px;
    display: flex;
    gap: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 2px;
}
.message-actions button {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background .1s;
}
.message-actions button:hover { background: var(--bg-hover); }

/* ── Typing Indicator ── */
.typing-indicator {
    padding: 4px 20px;
    font-size: 12px;
    color: var(--text-dim);
    font-style: italic;
}
.typing-dots span {
    animation: blink 1.4s infinite;
    font-size: 16px;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0; } 30% { opacity: 1; } }

/* ── Reply Preview ── */
.reply-preview {
    display: flex;
    align-items: center;
    padding: 8px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-sidebar);
    gap: 12px;
}
.reply-preview-content { flex: 1; min-width: 0; }
.reply-preview-author { font-size: 12px; font-weight: 600; color: var(--primary-light); display: block; }
.reply-preview-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* ── Input Area ── */
.input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-sidebar);
}

.file-input-hidden { display: none; }
.btn-attach {
    cursor: pointer;
    font-size: 20px;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background .1s;
}
.btn-attach:hover { background: var(--bg-hover); }

.input-wrapper { flex: 1; position: relative; }

.message-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
}
.message-input:focus { border-color: var(--primary); }

.btn-send {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .1s;
}
.btn-send:hover { background: var(--primary-dark); }
.btn-send.disabled { opacity: .35; cursor: not-allowed; }

.restricted-notice {
    padding: 12px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    background: var(--bg-sidebar);
}

/* ── Mention Popup ── */
.mention-popup {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 4px;
}
.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    width: 100%;
    color: var(--text);
    cursor: pointer;
    font-family: var(--font);
    font-size: 13px;
    text-align: left;
}
.mention-item:hover { background: var(--bg-hover); }

/* ── Members Panel ── */
.members-panel {
    width: 240px;
    min-width: 240px;
    border-left: 1px solid var(--border);
    background: var(--bg-sidebar);
    overflow-y: auto;
    padding: 12px;
}
.members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 14px;
}
.members-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); margin: 12px 0 6px; }

.member-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
}
.member-item:hover { background: var(--bg-hover); }
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ══════════════════════════════════════
   Modals
   ══════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}
.modal-card.modal-lg { max-width: 560px; }

.modal-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.modal-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: flex-end;
}
.modal-actions .btn-primary,
.modal-actions .btn-ghost { width: auto; }

/* ══════════════════════════════════════
   Analytics Panel
   ══════════════════════════════════════ */

.analytics-panel {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.analytics-header h2 { font-size: 22px; font-weight: 700; }

.date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kpi-value { font-size: 28px; font-weight: 700; color: var(--primary-light); }
.kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* Analytics sections */
.analytics-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.analytics-section h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }

/* Category bars */
.category-bars { display: flex; flex-direction: column; gap: 8px; }
.category-row { display: flex; align-items: center; gap: 12px; }
.category-name { width: 130px; font-size: 13px; color: var(--text-muted); text-align: right; flex-shrink: 0; }
.category-bar-track { flex: 1; height: 20px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.category-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 4px; transition: width .3s ease; }
.category-count { width: 40px; font-size: 13px; font-weight: 600; }

/* Top users */
.top-users-list { display: flex; flex-direction: column; gap: 6px; }
.top-user-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); }
.top-user-row:hover { background: var(--bg-hover); }
.top-user-rank { width: 28px; text-align: center; font-size: 14px; }
.top-user-name { flex: 1; font-size: 13px; }
.top-user-count { font-size: 12px; color: var(--text-dim); font-family: var(--font-mono); }

/* Group stats table */
.group-stats-table { font-size: 13px; }
.table-header, .table-row { display: grid; grid-template-columns: 1fr 100px 80px; gap: 8px; padding: 8px 4px; }
.table-header { color: var(--text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
.table-row:hover { background: var(--bg-hover); border-radius: var(--radius-sm); }

/* Daily chart */
.daily-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 100px;
    padding-top: 8px;
}
.daily-bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.daily-bar-fill { width: 100%; background: var(--primary); border-radius: 3px 3px 0 0; transition: height .3s ease; }
.daily-label { font-size: 9px; color: var(--text-dim); margin-top: 4px; }

.analytics-loading { text-align: center; padding: 60px; color: var(--text-muted); }

/* ══════════════════════════════════════
   Empty State & 404
   ══════════════════════════════════════ */

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty-state h2 { font-size: 22px; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

.not-found { text-align: center; padding: 80px 24px; }
.not-found h2 { font-size: 64px; font-weight: 800; color: var(--primary); }
.not-found p { color: var(--text-muted); margin: 8px 0 16px; }

/* ══════════════════════════════════════
   Scrollbar
   ══════════════════════════════════════ */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ══════════════════════════════════════
   Responsive
   ══════════════════════════════════════ */

@media (max-width: 768px) {
    .sidebar { width: 60px; min-width: 60px; }
    .user-details, .sidebar-actions, .group-section-label,
    .group-name, .group-meta, .lock-icon { display: none; }
    .group-item { justify-content: center; padding: 10px; }
    .group-icon { font-size: 22px; }
    .members-panel { display: none; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .analytics-header { flex-direction: column; align-items: flex-start; }
}

/* ══════════════════════════════════════
   Unread Badges
   ══════════════════════════════════════ */

.unread-badge {
    background: var(--primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    margin-left: auto;
    flex-shrink: 0;
    animation: badge-pop .2s ease;
}

.group-item.has-unread .group-name { font-weight: 700; color: var(--text); }

@keyframes badge-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ══════════════════════════════════════
   Toast Notifications
   ══════════════════════════════════════ */

.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

.toast-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    animation: toast-slide .3s ease;
    transition: opacity .3s, transform .3s;
}

.toast-item:hover { border-left-color: var(--accent); }

.toast-item.fade-out {
    opacity: 0;
    transform: translateX(100px);
}

.toast-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }

.toast-content { flex: 1; min-width: 0; }
.toast-group { display: block; font-size: 12px; font-weight: 600; color: var(--primary-light); }
.toast-message { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toast-close {
    background: transparent; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 14px; padding: 2px; flex-shrink: 0;
}
.toast-close:hover { color: var(--text); }

@keyframes toast-slide {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ══════════════════════════════════════
   Admin Panel
   ══════════════════════════════════════ */

.admin-layout { display: flex; height: 100vh; overflow: hidden; }

.admin-sidebar {
    width: 220px; min-width: 220px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: 16px 0;
}

.admin-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 16px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.admin-brand-text { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }

.admin-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 0 8px; }
.admin-nav-item {
    display: block;
    padding: 9px 14px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: background .1s;
}
.admin-nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.admin-nav-item.active { background: var(--bg-active); color: var(--text); font-weight: 600; border-left: 3px solid var(--primary); }

.admin-sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px;
}

.admin-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.admin-header h1 { font-size: 24px; font-weight: 700; }

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.admin-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }

.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.admin-table { font-size: 13px; }
.admin-table-header, .admin-table-row {
    display: grid;
    grid-template-columns: 1fr 100px 80px;
    gap: 8px;
    padding: 10px 8px;
    align-items: center;
}
.admin-table-header {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
}
.admin-table-row {
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}
.admin-table-row:hover { background: var(--bg-hover); }
.admin-table-row:last-child { border-bottom: none; }

.admin-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: var(--text-muted);
    font-size: 14px;
}

@media (max-width: 768px) {
    .admin-sidebar { width: 60px; min-width: 60px; }
    .admin-brand-text, .admin-nav-item { font-size: 0; }
    .admin-nav-item::first-letter { font-size: 18px; }
    .admin-sidebar-footer { display: none; }
    .admin-main { padding: 16px; }
    .admin-form-grid { grid-template-columns: 1fr; }
}
