/* ============================================
   EduLeads - Main Stylesheet
   Clean, modern, responsive
   ============================================ */

:root {
    --bg: #f1f5f9;
    --card: #ffffff;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --success: #22c55e;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --transition: all 0.2s ease;
}

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

html { font-size: 16px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   LAYOUT
   ============================================ */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.logo {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
}

.logo-icon { font-size: 24px; }
.logo-text { font-size: 20px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }

.nav-menu { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section {
    padding: 16px 16px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 2px 4px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--border-light);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-label { flex: 1; }

.nav-badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

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

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 12px; color: var(--text-muted); }

.logout-btn {
    display: block;
    text-align: center;
    padding: 10px;
    color: var(--danger);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.logout-btn:hover { background: var(--danger-light); }

/* Main Content */
.main {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    max-width: calc(100% - 260px);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.header h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }

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

/* ============================================
   COMPONENTS
   ============================================ */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59,130,246,0.4);
}

.btn-outline {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover { background: var(--border-light); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-warning { background: var(--warning); color: white; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 { font-size: 16px; font-weight: 700; }

.card-body { padding: 20px 24px; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.icon-blue { background: var(--primary-light); }
.icon-green { background: var(--success-light); }
.icon-orange { background: var(--warning-light); }
.icon-purple { background: var(--purple-light); }
.icon-red { background: var(--danger-light); }

.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 800; letter-spacing: -1px; margin-bottom: 6px; }
.stat-change { font-size: 12px; font-weight: 600; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.action-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    text-align: center;
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
    cursor: pointer;
}

.action-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.action-icon { font-size: 32px; margin-bottom: 12px; }
.action-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.action-desc { font-size: 12px; color: var(--text-muted); }

/* Two Column Layout */
.two-col {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    text-align: left;
    padding: 14px 24px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--border-light);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

.table tr:hover { background: var(--border-light); }

.student-name { font-weight: 600; font-size: 14px; }
.student-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Tags */
.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.tag-instagram { background: #fce7f3; color: #be185d; }
.tag-facebook { background: #dbeafe; color: #1d4ed8; }
.tag-google { background: #fee2e2; color: #991b1b; }
.tag-tiktok { background: #f3e8ff; color: #7c3aed; }
.tag-organic { background: #dcfce7; color: #166534; }
.tag-website { background: #cffafe; color: #0e7490; }
.tag-referral { background: #fef3c7; color: #92400e; }

/* Status Pills */
.status-pill {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-new { background: var(--primary-light); color: var(--primary-dark); }
.status-contacted { background: #e0e7ff; color: #3730a3; }
.status-trial_scheduled { background: var(--warning-light); color: #92400e; }
.status-trial_done { background: #dbeafe; color: #1e40af; }
.status-registered { background: var(--success-light); color: #166534; }
.status-inactive { background: #f3f4f6; color: #4b5563; }
.status-lost { background: var(--danger-light); color: #991b1b; }
.status-active { background: var(--success-light); color: #166534; }
.status-paused { background: var(--warning-light); color: #92400e; }

/* Schedule */
.schedule-list { padding: 16px 24px; }

.schedule-item {
    background: var(--border-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    border-left: 3px solid var(--primary);
}

.schedule-time { font-weight: 700; color: var(--primary); font-size: 13px; }
.schedule-student { font-weight: 600; margin-top: 4px; font-size: 14px; }
.schedule-subject { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* Notification Panel */
.notif-panel {
    position: fixed;
    right: 32px;
    top: 80px;
    width: 380px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 200;
    display: none;
    animation: slideIn 0.2s ease;
}

.notif-panel.show { display: block; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.notif-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
}

.notif-item:last-child { border-bottom: none; }

.notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.notif-success { background: var(--success-light); }
.notif-info { background: var(--primary-light); }
.notif-warn { background: var(--warning-light); }

.notif-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.notif-desc { font-size: 13px; color: var(--text-muted); }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Text utilities */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.link:hover { text-decoration: underline; }

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    margin-left: 4px;
}

/* Forms */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--card);
    color: var(--text);
    transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-textarea { min-height: 100px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 320px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--card);
}

.search-box::before {
    content: "🔍";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--border-light);
    padding: 4px;
    border-radius: var(--radius-sm);
    width: fit-content;
    margin-bottom: 20px;
}

.tab {
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    transition: var(--transition);
}

.tab.active {
    background: var(--card);
    color: var(--text);
    box-shadow: var(--shadow);
}

/* Pipeline Board */
.pipeline-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.pipeline-column {
    background: var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 500px;
}

.pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.pipeline-title {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pipeline-count {
    background: var(--card);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid var(--border);
}

.pipeline-card {
    background: var(--card);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    cursor: grab;
    transition: var(--transition);
}

.pipeline-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.pipeline-card.dragging { opacity: 0.5; }

.pipeline-card-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.pipeline-card-info { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.pipeline-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.avatar-group { display: flex; }
.avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card);
    margin-left: -8px;
}
.avatar:first-child { margin-left: 0; }

/* Dot */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-blue { background: var(--primary); }
.dot-orange { background: var(--warning); }
.dot-green { background: var(--success); }
.dot-purple { background: var(--purple); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15,23,42,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
    backdrop-filter: blur(4px);
}

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

.modal {
    background: var(--card);
    border-radius: var(--radius);
    width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    font-size: 18px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body { padding: 20px 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* WhatsApp Preview */
.wa-preview {
    background: linear-gradient(180deg, #075e54 0%, #128c7e 100%);
    border-radius: 16px;
    padding: 16px;
    max-width: 340px;
    margin: 0 auto;
    color: white;
}

.wa-header {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.wa-bubble {
    background: white;
    color: #111;
    border-radius: 12px 12px 12px 4px;
    padding: 14px;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.wa-time {
    font-size: 10px;
    color: rgba(255,255,255,0.7);
    text-align: right;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: toastIn 0.3s ease;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    background: var(--card);
}

.pagination a:hover { background: var(--border-light); }
.pagination .current {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Responsive */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
    .pipeline-board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { width: 100%; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; max-width: 100%; padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: 1fr; }
    .pipeline-board { grid-template-columns: 1fr; }
    .header { flex-direction: column; gap: 16px; align-items: flex-start; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-box { max-width: 100%; }
    .form-row { grid-template-columns: 1fr; }
}
