/* === RESET & VARIABLES === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --purple-500: #8b5cf6; --purple-600: #7c3aed; --purple-700: #6d28d9; --purple-800: #5b21b6;
    --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb; --gray-300: #d1d5db;
    --gray-400: #9ca3af; --gray-500: #6b7280; --gray-600: #4b5563; --gray-700: #374151; --gray-800: #1f2937; --gray-900: #111827;
    --green-50: #ecfdf5; --green-500: #10b981; --green-600: #059669; --green-700: #047857;
    --blue-50: #eff6ff; --blue-500: #3b82f6; --blue-600: #2563eb;
    --red-50: #fef2f2; --red-500: #ef4444; --red-600: #dc2626; --red-700: #b91c1c;
    --orange-50: #fff7ed; --orange-500: #f97316; --orange-600: #ea580c;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.06); --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1);
    --radius: 12px; --radius-sm: 8px; --transition: 150ms ease;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--gray-50); color: var(--gray-900); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--purple-600); text-decoration: none; } a:hover { color: var(--purple-700); }

/* LOGO */
.logo { width: 40px; height: 40px; background: var(--purple-600); color: var(--white); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; }
.logo-small { width: 32px; height: 32px; background: var(--purple-600); color: var(--white); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }

/* AUTH */
.auth-page { background: linear-gradient(135deg, var(--gray-900) 0%, var(--purple-800) 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-container { width: 100%; max-width: 420px; }
.auth-card { background: var(--white); border-radius: 16px; padding: 40px; box-shadow: 0 25px 60px rgba(0,0,0,.3); }
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header .logo { margin: 0 auto 16px; }
.auth-header h1 { font-size: 24px; color: var(--gray-900); font-weight: 700; margin-bottom: 4px; }
.auth-header p { color: var(--gray-500); font-size: 15px; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; color: var(--gray-700); }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px 14px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm);
    font-size: 15px; font-family: inherit; color: var(--gray-900); background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--purple-500); box-shadow: 0 0 0 3px rgba(139,92,246,.15); }
.form-group input::placeholder { color: var(--gray-400); }
.help-text { color: var(--gray-500); font-size: 12px; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--gray-700); cursor: pointer; padding: 6px 0; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--purple-600); }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; padding: 12px 0; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; font-family: inherit; text-decoration: none; cursor: pointer; border: none; transition: all var(--transition); white-space: nowrap; }
.btn-primary { background: var(--green-600); color: var(--white); } .btn-primary:hover { background: var(--green-700); color: var(--white); }
.btn-secondary { background: var(--purple-600); color: var(--white); } .btn-secondary:hover { background: var(--purple-700); color: var(--white); }
.btn-info { background: #3b82f6; color: var(--white); } .btn-info:hover { background: #2563eb; color: var(--white); }
.btn-warning { background: #f59e0b; color: var(--white); } .btn-warning:hover { background: #d97706; color: var(--white); }
.blocks-order { background: var(--gray-50); border: 1px dashed var(--gray-300); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; }
.blocks-order-head { font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 8px; }
.blocks-order-hint { font-weight: 400; color: var(--gray-500); font-size: 11px; }
.blocks-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.block-item { display: flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 10px; cursor: grab; font-size: 13px; color: var(--gray-800); }
.block-item.dragging { opacity: .5; border-color: var(--purple-500); }
.block-handle { color: var(--gray-400); font-size: 16px; cursor: grab; }
.block-label { font-weight: 600; }
.btn-outline { background: transparent; border: 2px solid var(--gray-200); color: var(--gray-700); } .btn-outline:hover { border-color: var(--gray-300); background: var(--gray-50); }
.btn-ghost { background: transparent; color: var(--gray-600); } .btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-danger { background: var(--red-500); color: var(--white); } .btn-danger:hover { background: var(--red-600); color: var(--white); }
.btn-block { width: 100%; text-align: center; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-large { padding: 14px 28px; font-size: 16px; }
.btn-cta { background: var(--red-500); color: var(--white); padding: 14px 32px; font-size: 16px; font-weight: 700; border-radius: var(--radius-sm); animation: ctaPulse 3s infinite; }
.btn-cta:hover { background: var(--red-600); color: var(--white); transform: translateY(-1px); }
@keyframes ctaPulse { 0%,100%{box-shadow:0 0 0 0 rgba(239,68,68,.4)} 50%{box-shadow:0 0 0 8px rgba(239,68,68,0)} }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 14px; font-weight: 500; }
.alert-error { background: var(--red-50); color: var(--red-700); border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: var(--green-700); border: 1px solid #a7f3d0; }

/* TEMPLATES BAR */
.templates-bar { background: var(--white); border: 1px solid var(--gray-100); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px 24px; margin-bottom: 20px; }
.templates-bar h3 { font-size: 16px; color: var(--gray-800); margin-bottom: 4px; }
.templates-bar .modal-sub { font-size: 13px; color: var(--gray-500); margin: 0 0 14px; }
.templates-bar .muted { color: var(--gray-500); font-size: 14px; margin: 0; }
.template-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.template-chip-wrap { position: relative; }
.template-chip { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 14px; border: 1px solid var(--gray-200); border-radius: 10px; background: var(--white); cursor: pointer; transition: all .15s ease; max-width: 240px; }
.template-chip:hover { border-color: var(--primary, #6366f1); box-shadow: 0 4px 12px rgba(99,102,241,.15); }
.template-chip strong { font-size: 14px; color: var(--gray-800); }
.template-chip span { font-size: 12px; color: var(--gray-500); }
.template-delete-form { position: absolute; top: -7px; right: -7px; }
.template-delete-btn { width: 22px; height: 22px; border: 1px solid #fecaca; border-radius: 50%; background: var(--white); color: var(--red-600); font-size: 16px; line-height: 18px; font-weight: 700; cursor: pointer; }
.template-delete-btn:hover { background: var(--red-500); color: var(--white); border-color: var(--red-500); }

/* MODALS */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 1100; padding: 20px; }
.modal-box { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px; max-width: 100%; max-height: 90vh; overflow: auto; }
.modal-box h3 { margin: 0 0 4px; font-size: 16px; color: var(--gray-800); font-weight: 600; }
.modal-sub { font-size: 13px; color: var(--gray-500); margin: 0 0 16px; }
.modal-field { margin-bottom: 14px; }
.modal-field label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* APP LAYOUT */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--gray-900); position: fixed; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-header { padding: 20px 24px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-header h2 { color: var(--white); font-size: 18px; font-weight: 700; }
.sidebar-nav { padding: 12px 0; flex: 1; display: flex; flex-direction: column; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 24px; color: var(--gray-400); text-decoration: none; font-size: 14px; font-weight: 500; transition: all var(--transition); border-left: 3px solid transparent; }
.nav-link:hover { background: rgba(255,255,255,.05); color: var(--white); }
.nav-link.active { background: rgba(139,92,246,.1); color: var(--white); border-left-color: var(--purple-500); }
.nav-link-danger:hover { color: var(--red-500); }
.main-content { margin-left: 260px; flex: 1; min-width: 0; }
.top-bar { background: var(--white); padding: 20px 32px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 10; }
.top-bar h1 { font-size: 22px; color: var(--gray-900); font-weight: 700; }
.top-bar-sub { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.top-bar-actions { display: flex; gap: 10px; align-items: center; }
.content { padding: 32px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card { background: var(--white); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; align-items: flex-start; gap: 16px; border: 1px solid var(--gray-100); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-card-purple .stat-icon { background: var(--purple-50); color: var(--purple-600); }
.stat-card-green .stat-icon { background: var(--green-50); color: var(--green-600); }
.stat-card-blue .stat-icon { background: var(--blue-50); color: var(--blue-600); }
.stat-card-orange .stat-icon { background: var(--orange-50); color: var(--orange-600); }
.stat-number { font-size: 28px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* SECTION / CARDS */
.section { margin-bottom: 32px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-header h2 { font-size: 18px; color: var(--gray-900); font-weight: 700; }
.empty-state { text-align: center; padding: 60px 24px; background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); }
.empty-state h3 { color: var(--gray-700); font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--gray-500); margin-bottom: 24px; font-size: 15px; }
.webinar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.webinar-card { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); transition: box-shadow var(--transition); }
.webinar-card:hover { box-shadow: var(--shadow-md); }
.webinar-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 12px; }
.webinar-card-header h3 { font-size: 16px; color: var(--gray-900); font-weight: 600; }
.webinar-card-stats { display: flex; gap: 16px; font-size: 13px; color: var(--gray-500); margin-bottom: 16px; padding-top: 12px; border-top: 1px solid var(--gray-100); }
.webinar-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* BADGES */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; flex-shrink: 0; }
.badge-active { background: var(--green-50); color: var(--green-700); }
.badge-draft { background: var(--gray-100); color: var(--gray-600); }
.badge-paused { background: #fef3c7; color: #92400e; }

/* FORM */
.webinar-form { max-width: 900px; }
.form-section { background: var(--white); padding: 24px; border-radius: var(--radius); margin-bottom: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); }
.form-section h3 { font-size: 16px; color: var(--gray-900); font-weight: 700; margin-bottom: 4px; }
.form-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.form-section-header h3 { margin-bottom: 0; }
.form-actions { display: flex; gap: 12px; padding-top: 8px; }
.dynamic-row { display: flex; gap: 10px; margin-bottom: 10px; align-items: center; flex-wrap: wrap; }
.dynamic-row input { padding: 8px 12px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 14px; color: var(--gray-900); }
.dynamic-row input:focus { outline: none; border-color: var(--purple-500); }
.input-small { width: 90px !important; }
.input-medium { width: 200px !important; flex-shrink: 0; }
.input-large { flex: 1; min-width: 150px !important; }
.cta-row-grid { display: grid; grid-template-columns: 80px 1fr 1.5fr 1fr auto; gap: 10px; align-items: center; }

/* TABLE */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--gray-100); }
.table th { background: var(--gray-50); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-500); }
.table td { font-size: 14px; color: var(--gray-700); }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.table .actions .btn { flex: 0 0 auto; min-width: 76px; justify-content: center; }
.text-muted { color: var(--gray-400); font-size: 13px; }
.lead-field { display: inline-block; margin-right: 12px; font-size: 14px; color: var(--gray-700); }

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar { display: none; } .main-content { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
    .cta-row-grid { grid-template-columns: 1fr; }
    .dynamic-row { flex-direction: column; align-items: stretch; }
    .input-small, .input-medium, .input-large { width: 100% !important; }
    .stats-grid { grid-template-columns: 1fr; }
    .webinar-grid { grid-template-columns: 1fr; }
    .top-bar { padding: 16px 20px; flex-direction: column; gap: 12px; align-items: flex-start; }
    .content { padding: 20px; }
}
