/* 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.3);
    color: var(--accent-green);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* 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: 12px; font-weight: 600; color: var(--text-secondary); }
.form-input, .form-input-sm {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
}

.form-input-sm { padding: 6px 10px; font-size: 12px; }

.form-input:focus, .form-input-sm:focus {
    border-color: var(--accent-indigo);
    outline: none;
}

.btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary { background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple)); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-success { background: var(--accent-green); color: #fff; }
.btn-success:hover { opacity: 0.9; }

.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.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active { display: flex; }

.modal-card {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    padding: 24px;
    box-shadow: var(--glass-shadow);
}

.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: 20px;

}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.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;
}
