/* AI Marketing Studio - Main Stylesheet */
:root {
  --primary: #6C3EFF;
  --primary-dark: #5025D1;
  --primary-light: #EDE8FF;
  --secondary: #FF6B35;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --dark: #0F172A;
  --dark-2: #1E293B;
  --dark-3: #334155;
  --gray: #64748B;
  --gray-light: #94A3B8;
  --border: #E2E8F0;
  --bg: #F8FAFC;
  --white: #FFFFFF;
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: all .2s; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--dark);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  transition: transform .3s ease;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px; font-weight: 700;
}

.sidebar-logo .logo-text {
  color: white;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  color: var(--gray-light);
  font-size: 11px;
}

.sidebar-nav { flex: 1; padding: 16px 0; }

.nav-section-label {
  color: var(--gray);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 12px 24px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  color: var(--gray-light);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
  cursor: pointer;
}

.nav-item:hover {
  color: white;
  background: rgba(255,255,255,.05);
  border-left-color: var(--primary);
}

.nav-item.active {
  color: white;
  background: rgba(108,62,255,.15);
  border-left-color: var(--primary);
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  opacity: .7;
  flex-shrink: 0;
}

.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.nav-badge.danger { background: var(--danger); }

.sidebar-bottom {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}

.sidebar-user:hover { background: rgba(255,255,255,.06); }

.sidebar-user .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}

.sidebar-user .user-info .user-name {
  color: white; font-size: 13px; font-weight: 600;
}
.sidebar-user .user-info .user-email {
  color: var(--gray); font-size: 11px;
}

/* ─── MAIN CONTENT ─── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-title { font-size: 18px; font-weight: 700; color: var(--dark); }
.topbar-subtitle { font-size: 13px; color: var(--gray); }

.page-content { padding: 28px; flex: 1; }

/* ─── CARDS ─── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
}

.card-body { padding: 20px; }

/* ─── STAT CARDS ─── */
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: transform .2s, box-shadow .2s;
}

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

.stat-card .stat-info .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}

.stat-card .stat-info .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--dark);
  line-height: 1;
}

.stat-card .stat-info .stat-change {
  font-size: 12px;
  font-weight: 500;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card .stat-info .stat-change.up { color: var(--success); }
.stat-card .stat-info .stat-change.down { color: var(--danger); }

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

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: var(--font);
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(108,62,255,.35); }

.btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--dark); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-outline { border: 1.5px solid var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary); color: white; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-xl { padding: 15px 32px; font-size: 16px; border-radius: 10px; }

.btn-icon { padding: 8px; border-radius: 8px; }

/* ─── FORM ELEMENTS ─── */
.form-group { margin-bottom: 18px; }

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

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--dark);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--font);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,62,255,.1);
}

.form-control::placeholder { color: var(--gray-light); }

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748B' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.input-group { position: relative; }
.input-group .input-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  font-size: 15px;
}
.input-group .form-control { padding-left: 38px; }

/* ─── TABLES ─── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  background: var(--bg);
  color: var(--gray);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--dark);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #DCFCE7; color: #15803D; }
.badge-warning { background: #FEF9C3; color: #854D0E; }
.badge-danger { background: #FEE2E2; color: #B91C1C; }
.badge-info { background: #DBEAFE; color: #1D4ED8; }
.badge-gray { background: #F1F5F9; color: var(--gray); }

/* ─── AVATAR ─── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.avatar-placeholder {
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  border-radius: 50%;
}

/* ─── GRID ─── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ─── MODALS ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(.95) translateY(10px);
  transition: transform .25s;
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

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

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

/* ─── PLATFORM ICONS ─── */
.platform-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.platform-facebook { background: #1877F2; color: white; }
.platform-instagram { background: linear-gradient(45deg,#F09433,#E6683C,#DC2743,#CC2366,#BC1888); color: white; }
.platform-linkedin { background: #0077B5; color: white; }
.platform-tiktok { background: #000; color: white; }
.platform-youtube { background: #FF0000; color: white; }
.platform-pinterest { background: #E60023; color: white; }
.platform-whatsapp { background: #25D366; color: white; }

/* ─── PROGRESS ─── */
.progress { background: var(--border); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar {
  height: 100%;
  border-radius: 20px;
  background: var(--primary);
  transition: width .4s ease;
}

/* ─── TABS ─── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-item {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.tab-item:hover { color: var(--dark); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── ALERTS ─── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-info { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.alert-success { background: #F0FDF4; border: 1px solid #BBF7D0; color: #166534; }
.alert-warning { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.alert-danger { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }

/* ─── DROPDOWN ─── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 300;
  overflow: hidden;
  display: none;
  animation: dropIn .15s ease;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--dark);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  transition: background .1s;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

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

/* ─── TOGGLES ─── */
.toggle {
  position: relative;
  width: 44px; height: 24px;
  display: inline-block;
  cursor: pointer;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 20px;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ─── NOTIFICATIONS ─── */
.notification-dot {
  position: absolute;
  top: 2px; right: 2px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
}

/* ─── LOADING ─── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(108,62,255,.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── UPLOAD ZONE ─── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* ─── CONTENT CARD ─── */
.content-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: white;
  transition: all .2s;
}
.content-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }

.content-card .content-preview {
  aspect-ratio: 1;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}

.content-card .content-meta {
  padding: 12px;
}

/* ─── CALENDAR ─── */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-day-header {
  background: var(--bg);
  padding: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gray);
  letter-spacing: .04em;
}

.calendar-day {
  background: white;
  min-height: 100px;
  padding: 8px;
  position: relative;
}

.calendar-day.today { background: #FFFBF0; }
.calendar-day.other-month .day-num { opacity: .4; }
.calendar-day .day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 4px;
}

.calendar-event {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* ─── LEAD CARD ─── */
.lead-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-260px); }
  .sidebar.mobile-open { transform: translateX(0); width: 260px; }
  .main-content { margin-left: 0; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

@media (max-width: 600px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 16px; }
}

/* ─── LANDING PAGE ─── */
.landing-hero {
  min-height: 100vh;
  background: linear-gradient(135deg, #0F0A2B 0%, #1a0e47 50%, #0F1B3B 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.landing-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 16px 0;
  transition: background .3s;
}

.landing-nav.scrolled {
  background: rgba(15,10,43,.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-lg { max-width: 1400px; margin: 0 auto; padding: 0 24px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(108,62,255,.2);
  border: 1px solid rgba(108,62,255,.4);
  color: #C4B5FD;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(36px, 6vw, 68px);
  font-weight: 900;
  color: white;
  line-height: 1.1;
  letter-spacing: -.02em;
  margin-bottom: 20px;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, #A78BFA, #818CF8, #38BDF8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(16px, 2vw, 20px);
  color: rgba(255,255,255,.65);
  margin-bottom: 36px;
  max-width: 560px;
  line-height: 1.7;
}

/* ─── ANIMATIONS ─── */
.fade-in { animation: fadeIn .5s ease forwards; }
.slide-up { animation: slideUp .5s ease forwards; }

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

/* ─── CUSTOM SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-light); }

/* ─── TOOLTIP ─── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 999;
  pointer-events: none;
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state .empty-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.empty-state .empty-text { color: var(--gray); font-size: 14px; }

/* ─── PRICING CARDS ─── */
.pricing-card {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  transition: all .3s;
}

.pricing-card.popular {
  border-color: var(--primary);
  transform: scale(1.04);
  box-shadow: 0 8px 40px rgba(108,62,255,.2);
  position: relative;
}

.popular-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 20px;
}
