/* ============================================
   CRM iCreativeGrafik - Custom Styles
   Consolidated from all views into one file
   ============================================ */

/* === CSS Variables === */
:root {
    --bg: #080b0f;
    --surface: #0d1117;
    --surface2: #151b23;
    --border: #21262d;
    --text: #e6edf3;
    --text2: #c9d1d9;
    --muted: #6e7681;
    --accent: #00cc6a;
    --accent-dim: rgba(0, 204, 106, .08);
    --blue: #58a6ff;
    --red: #f85149;
    --yellow: #d29922;
    --purple: #bc8cff;
    --pink: #f778ba;
    --sidebar-bg: #0d1117;
    --sidebar-border: #21262d;
    --sidebar-text: #6e7681;
    --sidebar-hover: rgba(0, 204, 106, .06);
    --sidebar-active: rgba(0, 204, 106, .1);
}

/* === Reset & Base === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, -apple-system, sans-serif; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #21262d; border-radius: 10px; }
* { scrollbar-width: thin; scrollbar-color: #21262d transparent; }
a { color: inherit; text-decoration: none; }

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.animate-fade-in { animation: fadeIn .5s ease-out; }

/* === Layout === */
.admin-layout { display: flex; min-height: 100vh; padding-left: 240px; }

/* === Sidebar === */
.sidebar { width: 240px; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border); position: fixed; left: 0; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden; z-index: 100; display: flex; flex-direction: column; }
.sidebar-brand { padding: 1.25rem; border-bottom: 1px solid var(--sidebar-border); display: flex; align-items: center; gap: .75rem; }
.sidebar-brand-icon { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #00995a); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.1rem; flex-shrink: 0; }
.sidebar-brand-text h1 { font-size: .95rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.sidebar-brand-text p { font-size: .65rem; color: var(--muted); }
.sidebar-nav { padding: .75rem 0; flex: 1; }
.sidebar-section { padding: .75rem 1.25rem .35rem; color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; }
.sidebar-nav a { display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; color: var(--sidebar-text); text-decoration: none; transition: all .15s; font-size: .85rem; font-weight: 500; border-left: 2px solid transparent; margin: 1px 0; }
.sidebar-nav a:hover { color: var(--accent); background: var(--sidebar-hover); }
.sidebar-nav a.active { color: var(--accent); background: var(--sidebar-active); border-left-color: var(--accent); font-weight: 600; }
.sidebar-nav a i { width: 20px; text-align: center; font-size: 1rem; opacity: .8; }
.sidebar-nav a:hover i, .sidebar-nav a.active i { opacity: 1; }

/* === Main Content === */
.main { padding: 1.5rem 2rem; flex: 1; min-width: 0; overflow-x: auto; }

/* === Login === */
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 2rem; width: 100%; max-width: 400px; box-shadow: 0 25px 50px rgba(0, 0, 0, .5); }
.login-logo { width: 80px; height: 80px; margin: 0 auto 1rem; border-radius: 16px; background: linear-gradient(135deg, var(--accent), #00995a); display: flex; align-items: center; justify-content: center; }
.login-logo svg { width: 40px; height: 40px; color: #fff; }
.login-title { font-size: 1.8rem; font-weight: 700; color: var(--accent); text-align: center; margin-bottom: .25rem; }
.login-subtitle { color: var(--muted); font-size: .85rem; text-align: center; margin-bottom: 2rem; }
.login-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 12px; padding: .75rem 1rem; font-size: .9rem; outline: none; transition: border-color .2s; }
.login-input:focus { border-color: var(--accent); }
.login-btn { width: 100%; background: var(--accent); color: #000; font-weight: 600; border: none; border-radius: 12px; padding: .75rem; font-size: .95rem; cursor: pointer; transition: all .2s; }
.login-btn:hover { background: #00b35c; transform: translateY(-1px); }
.login-error { background: rgba(248, 81, 73, .1); border: 1px solid rgba(248, 81, 73, .3); color: var(--red); padding: .75rem 1rem; border-radius: 12px; margin-bottom: 1.5rem; font-size: .85rem; }
.login-footer { margin-top: 1.5rem; text-align: center; color: var(--muted); font-size: .7rem; }

/* === Dashboard Stats === */
.wa-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.wa-stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; transition: all .2s; position: relative; overflow: hidden; }
.wa-stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0, 0, 0, .4); }
.wa-stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.wa-stat-card.c-green::before { background: var(--accent); }
.wa-stat-card.c-blue::before { background: var(--blue); }
.wa-stat-card.c-yellow::before { background: var(--yellow); }
.wa-stat-card.c-red::before { background: var(--red); }
.wa-stat-card.c-purple::before { background: var(--purple); }
.wa-stat-card.c-pink::before { background: var(--pink); }
.wa-stat-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.wa-stat-icon.green { background: rgba(0, 204, 106, .1); color: var(--accent); }
.wa-stat-icon.blue { background: rgba(88, 166, 255, .1); color: var(--blue); }
.wa-stat-icon.yellow { background: rgba(210, 153, 34, .1); color: var(--yellow); }
.wa-stat-icon.red { background: rgba(248, 81, 73, .1); color: var(--red); }
.wa-stat-icon.purple { background: rgba(188, 140, 255, .1); color: var(--purple); }
.wa-stat-icon.pink { background: rgba(247, 120, 186, .1); color: var(--pink); }
.wa-stat-value { font-size: 1.75rem; font-weight: 700; margin: .25rem 0; color: var(--text); }
.wa-stat-label { color: var(--muted); font-size: .8rem; }

/* === Dashboard Charts === */
.wa-chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.wa-chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.wa-chart-card h3 { font-size: .9rem; font-weight: 600; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; color: var(--text); }
.wa-chart-card h3 svg { color: var(--accent); width: 16px; height: 16px; }

/* === Conversations List === */
.wa-conv-row { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); transition: all .15s; text-decoration: none; color: inherit; }
.wa-conv-row:hover { background: var(--accent-dim); }
.wa-conv-avatar { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; border: 1px solid var(--border); }
.wa-conv-name { font-weight: 600; font-size: .85rem; color: var(--text); }
.wa-conv-msg { font-size: .78rem; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.wa-conv-time { font-size: .7rem; color: var(--muted); flex-shrink: 0; margin-left: auto; }
.wa-conv-badge { background: var(--accent); color: #000; font-size: .65rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* === Quick Actions === */
.wa-quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.wa-quick-btn { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1rem; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; transition: all .2s; cursor: pointer; }
.wa-quick-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.wa-quick-btn svg { width: 20px; height: 20px; color: var(--accent); }
.wa-quick-btn span { font-size: .75rem; font-weight: 500; color: var(--text2); }

/* === Status Row === */
.wa-status-row { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; border-bottom: 1px solid rgba(33, 38, 45, .5); }
.wa-status-row:last-child { border-bottom: none; }
.wa-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.wa-dot.green { background: var(--accent); animation: pulse 1.5s ease infinite; }
.wa-dot.yellow { background: var(--yellow); }

/* === Empty State === */
.wa-empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.wa-empty svg { width: 48px; height: 48px; margin: 0 auto 1rem; opacity: .3; }

/* === Section Title === */
.wa-section-title { font-size: .65rem; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; color: var(--muted); padding: .75rem 0 .5rem; }

/* === Chat (standalone) === */
.chat-layout { display: flex; height: 100vh; overflow: hidden; }
.chat-sidebar { width: 320px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.chat-sidebar-header { padding: 1rem; border-bottom: 1px solid var(--border); }
.chat-list { flex: 1; overflow-y: auto; }
.chat-list-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid rgba(33, 38, 45, .5); transition: background .15s; cursor: pointer; }
.chat-list-item:hover { background: var(--accent-dim); }
.chat-list-item.active { background: var(--accent-dim); }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; color: #000; font-weight: 700; flex-shrink: 0; }
.chat-area { flex: 1; display: flex; flex-direction: column; background: var(--bg); }
.chat-header { padding: .75rem 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .75rem; background: var(--surface); }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; }
.chat-msg { max-width: 65%; padding: .5rem .75rem; border-radius: 12px; margin-bottom: .5rem; font-size: .85rem; }
.chat-msg.outgoing { background: var(--accent); color: #000; margin-left: auto; border-bottom-right-radius: 4px; }
.chat-msg.incoming { background: var(--surface2); color: var(--text); border-bottom-left-radius: 4px; }
.chat-msg-time { font-size: .65rem; opacity: .6; margin-top: .25rem; }
.chat-input-bar { padding: .75rem 1rem; border-top: 1px solid var(--border); background: var(--surface); display: flex; gap: .5rem; }
.chat-input { flex: 1; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: .5rem .75rem; font-size: .85rem; outline: none; }
.chat-input:focus { border-color: var(--accent); }
.chat-send-btn { background: var(--accent); color: #000; border: none; border-radius: 10px; padding: .5rem 1rem; font-weight: 600; cursor: pointer; transition: background .2s; }
.chat-send-btn:hover { background: #00b35c; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }
.chat-empty-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--surface2); display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }

/* === Responsive === */
@media (max-width: 991px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .wa-chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .wa-stat-grid { grid-template-columns: 1fr 1fr; }
    .chat-sidebar { width: 100%; }
}
