/* HESSED EDU CRM - Glassmorphism Aesthetic Design System */
:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(18, 26, 43, 0.75);
    --bg-card-hover: rgba(28, 39, 64, 0.85);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(99, 102, 241, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-indigo: #6366f1;
    
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background: radial-gradient(circle at top right, #1e1b4b, var(--bg-dark) 50%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 100;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-left: 8px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.logo-title {
    display: flex;
    flex-direction: column;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtext {
    font-size: 10px;
    color: var(--accent-indigo);
    font-weight: 700;
    letter-spacing: 1px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-item:hover, .nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: #fff;
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
}

.nav-item.hidden {
    display: none !important;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.user-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.username {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role {
    font-size: 11px;
    color: var(--text-muted);
}

.logout-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    transition: color 0.2s;
}

.logout-icon-btn:hover {
    color: var(--accent-red);
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.header-title h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.text-secondary {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.system-status-badge {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--accent-green);
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.system-status-badge.offline {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

.system-status-badge i {
    font-size: 14px;
}

/* Glass Card Component */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.2s, border-color 0.2s;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Tab Contents */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Zone Section Titles */
.zone-header, .kpi-section-title {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    margin: 28px 0 16px 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kpi-section-title {
    margin-top: 0;
}

/* ZONE A: 7 Top KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.kpi-card.revenue-card {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.6), rgba(15, 23, 42, 0.8));
    border-color: rgba(99, 102, 241, 0.3);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.kpi-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.kpi-icon {
    font-size: 16px;
    color: var(--text-muted);
}

.kpi-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.badge-blue { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }
.badge-purple { background: rgba(139, 92, 246, 0.2); color: var(--accent-purple); }
.badge-green { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.badge-amber { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.badge-red { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }

.kpi-value {
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.kpi-value-lg {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 6px;
}

.kpi-value-lg .unit {
    font-size: 14px;
    font-weight: 500;
    margin-left: 4px;
    color: var(--text-secondary);
}

.kpi-sublabel {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.fill-blue { background: linear-gradient(to right, #3b82f6, #60a5fa); }
.fill-purple { background: linear-gradient(to right, #8b5cf6, #a78bfa); }

/* Interactive Segment Chips */
.kpi-chip-group {
    display: flex;
    gap: 4px;
    margin: 8px 0;
}

.chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover, .chip.active {
    background: var(--accent-indigo);
    color: #fff;
    border-color: var(--accent-indigo);
}

.kpi-footer-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.kpi-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-detail-link {
    background: none;
    border: none;
    color: var(--accent-indigo);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-detail-link:hover {
    color: #a5b4fc;
    text-decoration: underline;
}

.btn-export-icon {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-green);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.btn-export-icon:hover {
    background: var(--accent-green);
    color: #fff;
}

/* Color Classes */
.text-green { color: var(--accent-green); }
.text-amber { color: var(--accent-amber); }
.text-red { color: var(--accent-red); }
.text-blue { color: var(--accent-blue); }
.text-purple { color: var(--accent-purple); }

/* ZONE B & D: Grid Layouts */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.analytics-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
}

.sub-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* Donut & HQ/Branch Layout */
.donut-analytics-container {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 0;
}

.donut-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
}

.donut-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.donut-center-text .pct {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    color: #fff;
}

.donut-center-text .lbl {
    font-size: 11px;
    color: var(--text-muted);
}

.hq-branch-breakdown {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.breakdown-item .b-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
}

.b-val {
    font-weight: 700;
}

/* Line Chart Wrapper */
.chart-wrapper {
    width: 100%;
    height: 220px;
    position: relative;
}

/* ZONE C: Lead Channel Horizontal Bars */
.channel-card {
    margin-bottom: 24px;
}

.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-buttons {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.channel-tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.channel-tab-btn.active {
    background: var(--accent-indigo);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.horizontal-bars-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.bar-label {
    width: 140px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.bar-track {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent-indigo), var(--accent-purple));
    border-radius: 6px;
    transition: width 0.6s ease;
}

.bar-value {
    width: 70px;
    text-align: right;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}

/* ZONE D: Weekly Calendar & Notice Cards */
.schedule-card, .notice-card {
    min-height: 280px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.week-navigator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.btn-nav-week {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 6px;
}

.btn-nav-week:hover { color: #fff; }

.week-range-text {
    font-size: 12px;
    font-weight: 600;
}

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.schedule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 4px solid var(--accent-indigo);
}

.schedule-item.cat-meeting { border-left-color: var(--accent-blue); }
.schedule-item.cat-sales { border-left-color: var(--accent-green); }
.schedule-item.cat-training { border-left-color: var(--accent-purple); }
.schedule-item.cat-etc { border-left-color: var(--accent-amber); }

.time-slot {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 80px;
}

.sch-title {
    font-size: 13px;
    flex: 1;
    font-weight: 500;
}

.location-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.calendar-legend {
    display: flex;
    gap: 16px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 11px;
    color: var(--text-muted);
}

.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.cat-meeting { background: var(--accent-blue); }
.dot.cat-sales { background: var(--accent-green); }
.dot.cat-training { background: var(--accent-purple); }
.dot.cat-etc { background: var(--accent-amber); }

/* Notice List */
.notice-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.notice-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.n-left { display: flex; align-items: center; gap: 10px; }
.badge-new {
    background: var(--accent-red);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
}

.n-title { font-size: 13px; font-weight: 500; }
.n-date { font-size: 11px; color: var(--text-muted); }

.btn-link-all {
    background: none;
    border: none;
    color: var(--accent-indigo);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Data Table */
.table-container {
    width: 100%;
    overflow-x: auto;
}

.max-h-400 { max-height: 400px; overflow-y: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.inst-name-link {
    color: #a5b4fc;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

/* Form Controls */
.custom-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 2px; }
.form-input, .form-input-sm, .form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.form-input-sm { padding: 8px 12px; font-size: 13px; border-radius: 8px; }

.form-input:focus, .form-input-sm:focus, .form-control:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    outline: none;
}

.btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary { 
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { 
    opacity: 0.95; 
    transform: translateY(-1px); 
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}
.btn-success { background: var(--accent-green); color: #fff; }
.btn-success:hover { opacity: 0.9; }

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.w-full { width: 100%; }
.max-w-600 { max-width: 600px; margin: 0 auto; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active { display: flex; animation: fadeInModal 0.2s ease-out forwards; }

@keyframes fadeInModal {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    padding: 28px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.modal-card.modal-lg { max-width: 900px; }
.login-card { max-width: 400px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close-btn, .btn-close-modal {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close-btn:hover, .btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.modal-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
}

.modal-actions { display: flex; gap: 10px; align-items: center; }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2col { grid-template-columns: 1fr; }
    .sidebar { width: 80px; padding: 16px 8px; }
    .logo-text, .logo-subtext, .nav-item span, .user-info { display: none; }
}

/* Region / City Display Tags */
.sido-tag {
    background: rgba(99, 102, 241, 0.18);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #a5b4fc;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-block;
    margin-right: 4px;
}

.sigungu-text {
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
}

/* ==========================================================================
   H COPILOT DRAWER & STYLES
   ========================================================================== */
.btn-copilot {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    border: none;
    color: #ffffff;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.btn-copilot:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.copilot-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.copilot-overlay.active {
    opacity: 1;
    visibility: visible;
}

.copilot-drawer {
    position: fixed;
    top: 0; right: -520px;
    width: 500px; height: 100vh;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(16px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.7);
    z-index: 1999;
    display: flex;
    flex-direction: column;
    transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.copilot-drawer.active {
    right: 0;
}

.copilot-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(31, 41, 55, 0.5);
}

.copilot-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.copilot-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.copilot-title h3 {
    font-size: 18px; font-weight: 700; color: #f9fafb; margin: 0;
}

.copilot-subtitle {
    font-size: 11px; color: #9ca3af;
}

.copilot-close-btn {
    background: none; border: none; color: #9ca3af;
    font-size: 20px; cursor: pointer; transition: color 0.2s;
}

.copilot-close-btn:hover { color: #fff; }

.copilot-chips-container {
    padding: 14px 20px;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chips-label {
    font-size: 11px; font-weight: 600; color: #818cf8; text-transform: uppercase;
    display: block; margin-bottom: 8px; letter-spacing: 0.5px;
}

.chips-list {
    display: flex; flex-wrap: wrap; gap: 6px;
}

.chip-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #d1d5db;
    font-size: 12px;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(129, 140, 248, 0.5);
    color: #fff;
    transform: translateY(-1px);
}

.copilot-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    display: flex;
    gap: 12px;
    max-width: 95%;
    animation: fadeIn 0.3s ease;
}

.user-bubble {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-bubble .bubble-content {
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    border-radius: 16px 16px 2px 16px;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.ai-bubble {
    align-self: flex-start;
}

.ai-bubble .bubble-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(129, 140, 248, 0.2);
    border: 1px solid rgba(129, 140, 248, 0.4);
    color: #818cf8;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}

.ai-bubble .bubble-content {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border-radius: 16px 16px 16px 2px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.6;
    width: 100%;
}

.welcome-bubble .bubble-content {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.25);
}

.ai-insight {
    font-size: 13px; font-weight: 500; color: #f1f5f9; margin-bottom: 10px;
}

.sql-code-block {
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 10px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    color: #38bdf8;
    overflow-x: auto;
    white-space: pre-wrap;
    margin: 10px 0;
}

.copilot-data-table-wrapper {
    margin-top: 10px;
    max-height: 220px;
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.copilot-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.copilot-data-table th {
    background: rgba(30, 41, 59, 0.9);
    color: #94a3b8;
    padding: 8px 10px;
    text-align: left;
    position: sticky; top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.copilot-data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
}

.copilot-footer {
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.copilot-input-wrapper {
    display: flex;
    gap: 8px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    padding: 6px 10px;
}

.copilot-input-wrapper:focus-within {
    border-color: #818cf8;
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.3);
}

#copilot-input {
    flex: 1;
    background: none; border: none; outline: none;
    color: #fff; font-size: 13px; resize: none;
    font-family: inherit; line-height: 1.4;
    padding: 4px 0;
}

.copilot-send-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none; border-radius: 8px;
    color: #fff; width: 32px; height: 32px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s;
}

.copilot-send-btn:hover {
    transform: scale(1.05);
}

.copilot-footer-note {
    font-size: 11px; color: #64748b;
    margin-top: 6px; display: flex; align-items: center; gap: 6px;
}

/* Workspace Selector Component */
.workspace-dropdown-wrapper {
    position: relative;
}

.btn-workspace {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-workspace:hover {
    background: rgba(47, 63, 86, 0.9);
    border-color: #818cf8;
    color: #fff;
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.25);
}

.workspace-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 240px;
    background: #0f172a;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 1000;
    overflow: hidden;
    backdrop-filter: blur(16px);
}

.workspace-menu.show {
    display: block;
}

.workspace-menu-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    padding: 10px 14px 6px;
    letter-spacing: 0.5px;
}

.workspace-list {
    max-height: 200px;
    overflow-y: auto;
}

.workspace-item {
    padding: 10px 14px;
    font-size: 13px;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.15s;
}

.workspace-item:hover {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.workspace-item.active {
    background: rgba(99, 102, 241, 0.25);
    color: #38bdf8;
    font-weight: 600;
}

.workspace-item .ws-badge {
    font-size: 10px;
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    padding: 2px 6px;
    border-radius: 6px;
}

.workspace-menu-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #818cf8;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}

.workspace-menu-footer:hover {
    background: rgba(99, 102, 241, 0.2);
}

/* Workspace Manage List Cards */
.ws-manage-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s, border-color 0.15s;
}

.ws-manage-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.ws-manage-card.active-card {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.08);
}

.ws-manage-info {
    flex: 1;
    min-width: 0;
    margin-right: 12px;
}

.ws-manage-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ws-manage-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ws-manage-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-ws-action {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-ws-action:hover {
    background: rgba(255, 255, 255, 0.16);
}

.btn-ws-action.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

.btn-ws-action.primary {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
}

.btn-ws-action.primary:hover {
    background: rgba(99, 102, 241, 0.4);
    color: #ffffff;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
