/*
 * Jwal ERP — Next-Gen Luxury Design System v2.0
 * Fully redesigned from scratch
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ═══════════════════════════════
   ROOT DESIGN TOKENS
═══════════════════════════════ */
:root {
    --bg-base:       #0a0a0a;
    --bg-surface:    #111111;
    --bg-elevated:   #161616;
    --bg-overlay:    rgba(255,255,255,0.03);
    --border-subtle: rgba(255,255,255,0.06);
    --border-light:  rgba(255,255,255,0.10);
    --border-accent: rgba(0,200,170,0.35);

    --teal-400:      #2dd4bf;
    --teal-500:      #14b8a6;
    --teal-600:      #0d9488;
    --teal-glow:     rgba(20, 184, 166, 0.18);
    --teal-shadow:   0 0 30px rgba(20,184,166,0.12);

    --white:         #ffffff;
    --gray-100:      #f4f4f5;
    --gray-400:      #a1a1aa;
    --gray-500:      #71717a;
    --gray-700:      #3f3f46;

    --text-primary:   #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted:     #52525b;

    --green:  #22c55e;
    --amber:  #f59e0b;
    --red:    #ef4444;
    --blue:   #3b82f6;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --shadow-card: 0 1px 3px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.3);
    --shadow-glow: 0 0 0 1px var(--border-accent), 0 8px 32px var(--teal-glow);

    --sidebar-width: 260px;
    --topbar-height: 60px;

    --font-base: 'Inter', 'Plus Jakarta Sans', sans-serif;
    --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════
   RESET & BASE
═══════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

body {
    font-family: var(--font-base);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    background-image:
        radial-gradient(ellipse 60% 50% at 20% -10%, rgba(20,184,166,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 40% 30% at 80% 110%, rgba(20,184,166,0.04) 0%, transparent 60%);
}

/* ═══════════════════════════════
   SIDEBAR NAVIGATION
═══════════════════════════════ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
}

.sidebar-logo-icon {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--teal-500), var(--teal-400));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: #fff;
    box-shadow: 0 0 16px var(--teal-glow);
    flex-shrink: 0;
}

.sidebar-logo-text { line-height: 1.2; }
.sidebar-logo-text .name { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.sidebar-logo-text .tagline { font-size: 0.68rem; color: var(--teal-400); font-weight: 500; letter-spacing: 0.5px; }

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 20px;
    scrollbar-width: none;
}
.sidebar-scroll::-webkit-scrollbar { display: none; }

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 16px 12px 6px;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    border: 1px solid transparent;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link-custom:hover {
    color: var(--text-primary);
    background: var(--bg-overlay);
    border-color: var(--border-subtle);
}

.nav-link-custom.active {
    color: var(--teal-400);
    background: rgba(20,184,166,0.08);
    border-color: var(--border-accent);
}

.nav-link-custom .nav-icon {
    width: 18px; height: 18px;
    font-size: 0.85rem;
    color: inherit;
    flex-shrink: 0;
    text-align: center;
    line-height: 1;
}

.nav-link-custom .nav-badge {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--teal-glow);
    color: var(--teal-400);
    border: 1px solid var(--border-accent);
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border-subtle);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}
.sidebar-user:hover { background: var(--bg-overlay); }
.sidebar-user img {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border-accent);
    object-fit: cover;
}
.sidebar-user-info .uname { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.sidebar-user-info .urole { font-size: 0.7rem; color: var(--teal-400); line-height: 1.2; }

/* ═══════════════════════════════
   TOPBAR
═══════════════════════════════ */
.topbar {
    position: fixed;
    top: 0; left: var(--sidebar-width); right: 0;
    height: var(--topbar-height);
    background: rgba(10,10,10,0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    z-index: 90;
}

.topbar-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.topbar-subtitle { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.topbar-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.topbar-pill .live-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: blink 1.8s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

.icon-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.88rem;
    text-decoration: none;
}
.icon-btn:hover { border-color: var(--border-accent); color: var(--teal-400); }

/* ═══════════════════════════════
   MAIN CONTENT
═══════════════════════════════ */
.main-content {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
}

.page-body { padding: 28px; }

/* ═══════════════════════════════
   CARDS
═══════════════════════════════ */
.card-glass {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: var(--transition);
}
.card-glass:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-card);
}

.card-glass.card-teal {
    background: linear-gradient(135deg, rgba(20,184,166,0.08), rgba(20,184,166,0.02));
    border-color: var(--border-accent);
}

/* STAT CARD */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--teal-500), transparent);
    opacity: 0;
    transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-accent); }
.stat-card:hover::before { opacity: 1; }

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.stat-change {
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}
.stat-change.up   { color: var(--green); }
.stat-change.down { color: var(--red);   }

.stat-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius-md);
    background: rgba(20,184,166,0.1);
    border: 1px solid var(--border-accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    color: var(--teal-400);
    margin-left: auto;
    position: absolute;
    top: 20px; right: 20px;
}

/* ═══════════════════════════════
   SECTION HEADER
═══════════════════════════════ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.section-title i { color: var(--teal-500); font-size: 0.9rem; }

/* ═══════════════════════════════
   TABLES
═══════════════════════════════ */
.table-glass { color: var(--text-primary); width: 100%; border-collapse: collapse; }
.table-glass th {
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 10px 14px;
    white-space: nowrap;
}
.table-glass td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem;
}
.table-glass tbody tr:last-child td { border-bottom: none; }
.table-glass tbody tr:hover td { background: rgba(255,255,255,0.015); }

/* ═══════════════════════════════
   BADGES
═══════════════════════════════ */
.badge-new {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.badge-green  { background: rgba(34,197,94,0.1);  color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.badge-teal   { background: rgba(20,184,166,0.1); color: var(--teal-400); border: 1px solid var(--border-accent); }
.badge-amber  { background: rgba(245,158,11,0.1); color: var(--amber);  border: 1px solid rgba(245,158,11,0.2); }
.badge-red    { background: rgba(239,68,68,0.1);  color: var(--red);    border: 1px solid rgba(239,68,68,0.2); }
.badge-gray   { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid var(--border-subtle); }

/* ═══════════════════════════════
   FORMS
═══════════════════════════════ */
.form-control-glass {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 9px 14px;
    font-family: var(--font-base);
    font-size: 0.875rem;
    transition: var(--transition);
    width: 100%;
}
.form-control-glass::placeholder { color: var(--text-muted); }
.form-control-glass:focus {
    outline: none;
    border-color: var(--teal-500);
    box-shadow: 0 0 0 3px rgba(20,184,166,0.12);
    background: var(--bg-surface);
    color: var(--text-primary);
}
.form-label-new {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    display: block;
}

/* ═══════════════════════════════
   BUTTONS
═══════════════════════════════ */
.btn-primary-new {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px;
    background: var(--teal-500);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font-base);
}
.btn-primary-new:hover { background: var(--teal-600); color: #fff; box-shadow: var(--teal-shadow); transform: translateY(-1px); }

.btn-secondary-new {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: var(--font-base);
}
.btn-secondary-new:hover { border-color: var(--border-light); color: var(--text-primary); }

/* Legacy support aliases */
.btn-gold { @extend .btn-primary-new; background: var(--teal-500); color: #fff; border: none; border-radius: var(--radius-md); padding: 9px 18px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: var(--transition); }
.btn-gold:hover { background: var(--teal-600); color: #fff; }
.btn-glass { background: var(--bg-elevated); border: 1px solid var(--border-subtle); color: var(--text-secondary); border-radius: var(--radius-md); padding: 9px 18px; font-size: 0.85rem; cursor: pointer; transition: var(--transition); }
.btn-glass:hover { border-color: var(--border-accent); color: var(--text-primary); }

/* ═══════════════════════════════
   PROGRESS & CHARTS
═══════════════════════════════ */
.progress-bar-new {
    height: 5px;
    background: var(--bg-elevated);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal-600), var(--teal-400));
    border-radius: 999px;
    transition: width 1s ease;
}

/* ═══════════════════════════════
   KANBAN
═══════════════════════════════ */
.kanban-col {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.kanban-col-header {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.kanban-dot { width: 8px; height: 8px; border-radius: 50%; }
.kanban-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
    transition: var(--transition);
    cursor: default;
}
.kanban-card:hover { border-color: var(--border-accent); transform: translateY(-2px); box-shadow: var(--teal-shadow); }

/* ═══════════════════════════════
   MODALS
═══════════════════════════════ */
.modal-content {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-xl) !important;
    color: var(--text-primary) !important;
}
.modal-header, .modal-footer { border-color: var(--border-subtle) !important; }
.modal-title { font-size: 0.95rem !important; font-weight: 600 !important; }

/* ═══════════════════════════════
   AI CHAT FLOATING WIDGET
═══════════════════════════════ */
.ai-chat-widget {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 360px;
    background: var(--bg-surface);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), var(--teal-shadow);
    z-index: 9999;
    overflow: hidden;
}
.ai-chat-header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    background: rgba(20,184,166,0.06);
    border-bottom: 1px solid var(--border-subtle);
}
.ai-chat-body { padding: 12px 14px; height: 200px; overflow-y: auto; }
.ai-chat-footer { padding: 10px 12px; border-top: 1px solid var(--border-subtle); display: flex; gap: 8px; }
.ai-msg { font-size: 0.82rem; margin-bottom: 8px; padding: 8px 10px; border-radius: 10px; line-height: 1.5; }
.ai-msg.bot { background: rgba(20,184,166,0.08); border: 1px solid var(--border-accent); color: var(--text-primary); }
.ai-msg.user { background: var(--bg-elevated); border: 1px solid var(--border-subtle); color: var(--text-secondary); text-align: right; }

/* ═══════════════════════════════
   ANIMATIONS & UTILITIES
═══════════════════════════════ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease forwards; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.animate-pulse { animation: pulse 2s infinite; }

.text-teal   { color: var(--teal-400) !important; }
.text-muted-custom { color: var(--text-muted) !important; }
.border-teal { border-color: var(--border-accent) !important; }
