/* ═══════════════════════════════════════════════
   Tara Media Works CRM — Master Stylesheet
   ═══════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────── */
:root {
  --primary:        #1e3a5f;
  --primary-light:  #2d5a8e;
  --accent:         #f97316;
  --accent-dark:    #ea6c0a;
  --sidebar-bg:     #1a2740;
  --sidebar-text:   #8fa3be;
  --sidebar-hover:  rgba(249,115,22,.12);
  --sidebar-active: #f97316;
  --bg:             #f0f4f8;
  --card-bg:        #ffffff;
  --text:           #1e293b;
  --text-muted:     #64748b;
  --border:         #e2e8f0;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;
  --sidebar-w:      260px;
  --topbar-h:       64px;
  --radius:         10px;
  --shadow:         0 2px 12px rgba(0,0,0,.07);
  --shadow-md:      0 4px 24px rgba(0,0,0,.10);
}

/* ── Reset / Base ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ══════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════ */
.login-page { background: linear-gradient(135deg, #0f1f3d 0%, #1a2740 60%, #0d1b2e 100%); min-height: 100vh; }

.login-container {
  display: flex;
  min-height: 100vh;
}

.login-left {
  flex: 1;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
}

.login-brand { margin-bottom: 2.5rem; }
.brand-icon {
  width: 64px; height: 64px;
  background: var(--accent);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; color: #fff;
  margin-bottom: 1rem;
}
.login-brand h1 { font-size: 2rem; font-weight: 700; margin: 0 0 .5rem; }
.login-brand p  { color: #94a3b8; font-size: .9rem; max-width: 400px; }

.feature-item {
  display: flex; align-items: center; gap: .75rem;
  color: #94a3b8; padding: .5rem 0; font-size: .875rem;
}
.feature-item i { color: var(--accent); width: 20px; text-align: center; }

.login-right {
  width: 480px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 2.5rem;
}
.login-form-wrap { width: 100%; max-width: 380px; }
.login-title    { font-size: 1.6rem; font-weight: 700; color: var(--primary); margin-bottom: .25rem; }
.login-subtitle { color: var(--text-muted); margin-bottom: 1.75rem; font-size: .875rem; }

.input-icon-wrap { position: relative; }
.input-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: .875rem; pointer-events: none;
}
.input-icon-wrap .form-control {
  padding-left: 2.75rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  font-size: .875rem;
  height: 44px;
  transition: border-color .2s;
}
.input-icon-wrap .form-control:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}
.pass-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 4px;
}
.btn-login {
  height: 46px; font-weight: 600; font-size: .9rem;
  background: var(--accent); border: none; border-radius: var(--radius);
  transition: background .2s, transform .1s;
}
.btn-login:hover { background: var(--accent-dark); transform: translateY(-1px); }

/* ══════════════════════════════════════════════
   LAYOUT — SIDEBAR + MAIN
   ══════════════════════════════════════════════ */
.crm-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 300;
  transition: transform .3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  min-height: var(--topbar-h);
}
.brand-icon-sm {
  width: 38px; height: 38px; min-width: 38px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem;
}
.brand-name { display: block; color: #fff; font-size: .95rem; font-weight: 700; line-height: 1.2; }
.brand-sub  { display: block; color: var(--sidebar-text); font-size: .7rem; }

.sidebar-nav { flex: 1; padding: 1rem 0; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: .65rem 1.25rem;
  color: var(--sidebar-text);
  border-radius: 0;
  cursor: pointer;
  transition: background .18s, color .18s;
  font-size: .875rem;
  position: relative;
}
.nav-item i { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: var(--sidebar-hover);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar-bottom {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: .75rem 0;
}
.user-mini {
  display: flex; align-items: center; gap: 10px;
  padding: .75rem 1.25rem;
  margin-bottom: .25rem;
}
.user-avatar-sm {
  width: 34px; height: 34px; min-width: 34px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .85rem;
}
.user-mini-name { display: block; color: #fff; font-size: .8rem; font-weight: 600; line-height: 1.2; }
.user-mini-role { display: block; color: var(--sidebar-text); font-size: .7rem; }

.logout-btn { color: #f87171 !important; }
.logout-btn:hover { background: rgba(239,68,68,.12) !important; }

/* ── Main Area ──────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .3s ease;
}

/* ── Topbar ──────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.topbar-title {
  font-size: 1.1rem; font-weight: 600; color: var(--primary);
  margin: 0; flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 1rem; }

.sidebar-toggle {
  background: none; border: none; padding: 8px;
  color: var(--text-muted); cursor: pointer;
  border-radius: 8px; font-size: 1rem;
  transition: background .15s;
}
.sidebar-toggle:hover { background: var(--bg); }

/* Notifications */
.notif-wrap { position: relative; }
.icon-btn {
  background: none; border: none; cursor: pointer;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1rem;
  position: relative; transition: background .15s;
}
.icon-btn:hover { background: var(--bg); }
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--danger);
  color: #fff; font-size: .6rem; font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

.notif-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 320px; background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  display: none; z-index: 400;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: .875rem;
}
.mark-all-read {
  background: none; border: none; color: var(--accent);
  font-size: .75rem; cursor: pointer; font-family: inherit;
}
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-item {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: #fff7ed; }
.notif-item-title { font-weight: 600; font-size: .8rem; color: var(--text); }
.notif-item-msg   { font-size: .75rem; color: var(--text-muted); margin: 2px 0 4px; }
.notif-item-time  { font-size: .7rem; color: var(--text-muted); }
.notif-empty      { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: .875rem; }
.notif-loading    { padding: 1rem; text-align: center; color: var(--text-muted); }

.topbar-user  { display: flex; align-items: center; gap: 10px; }
.user-avatar-top {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .85rem;
}
.topbar-username { font-size: .8rem; font-weight: 600; line-height: 1.2; }
.topbar-role     { font-size: .7rem; color: var(--text-muted); }

/* ── Page Content ───────────────────────────── */
.page-content { flex: 1; padding: 1.5rem; }

/* ══════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════ */
.crm-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.card-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
}
.card-title {
  font-size: 1rem; font-weight: 600; color: var(--primary); margin: 0;
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; color: #fff; flex-shrink: 0;
}
.stat-icon.blue   { background: var(--info); }
.stat-icon.green  { background: var(--success); }
.stat-icon.orange { background: var(--accent); }
.stat-icon.red    { background: var(--danger); }
.stat-icon.purple { background: #8b5cf6; }

.stat-info {}
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat-label { font-size: .775rem; color: var(--text-muted); margin-top: 2px; }

/* ══════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════ */
.crm-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-info     { background: #dbeafe; color: #1d4ed8; }
.badge-primary  { background: #ede9fe; color: #5b21b6; }
.badge-success  { background: #d1fae5; color: #065f46; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-secondary{ background: #f1f5f9; color: #475569; }

/* ══════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════ */
.crm-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.crm-table th {
  background: var(--bg);
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.crm-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.crm-table tr:last-child td { border-bottom: none; }
.crm-table tr:hover td { background: #fafbfc; }

/* ══════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════ */
.btn-primary { background: var(--accent); border-color: var(--accent); font-weight: 500; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-outline-primary { color: var(--accent); border-color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); }

.btn-sm { padding: .3rem .75rem; font-size: .78rem; }
.btn-xs { padding: .2rem .55rem; font-size: .72rem; border-radius: 6px; }

.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ══════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════ */
.form-label { font-weight: 500; font-size: .8rem; color: var(--text); margin-bottom: 5px; }
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  font-family: 'Poppins', sans-serif;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249,115,22,.1);
}
textarea.form-control { resize: vertical; min-height: 100px; }

/* ══════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════ */
.modal-content { border-radius: 14px; border: none; box-shadow: var(--shadow-md); }
.modal-header {
  background: var(--primary);
  color: #fff; border-radius: 14px 14px 0 0;
  padding: 1rem 1.5rem;
}
.modal-header .modal-title { font-weight: 600; font-size: .95rem; }
.modal-header .btn-close { filter: invert(1); }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: .75rem 1.5rem; border-top: 1px solid var(--border); }

/* ══════════════════════════════════════════════
   CALENDAR (FullCalendar override)
   ══════════════════════════════════════════════ */
#admin-calendar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
}
.fc .fc-toolbar-title { font-size: 1rem; font-weight: 700; color: var(--primary); }
.fc .fc-button-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  font-size: .8rem !important;
  font-family: 'Poppins', sans-serif !important;
  border-radius: 8px !important;
}
.fc .fc-button-primary:hover { background: var(--primary-light) !important; }
.fc .fc-button-primary.fc-button-active { background: var(--accent) !important; border-color: var(--accent) !important; }
.fc .fc-day-today .fc-daygrid-day-number { background: var(--accent); color: #fff; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.fc .fc-daygrid-day:hover { background: #fff7ed; cursor: pointer; }
.fc-event {
  border: none !important;
  border-radius: 4px !important;
  font-size: .72rem !important;
  font-weight: 600 !important;
  padding: 2px 6px !important;
  cursor: pointer;
}
.fc-event-task-pending   { background: #3b82f6 !important; }
.fc-event-task-progress  { background: #8b5cf6 !important; }
.fc-event-task-submitted { background: #f59e0b !important; }
.fc-event-task-completed { background: #10b981 !important; }
.fc-event-requirement    { background: #ec4899 !important; }

/* Calendar date detail modal */
.date-detail-section { margin-bottom: 1.25rem; }
.date-detail-section h6 {
  font-size: .78rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: .75rem;
  display: flex; align-items: center; gap: 8px;
}
.date-detail-section h6::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.task-detail-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: .7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: .5rem;
  background: #fafbfc;
}
.task-detail-row:last-child { margin-bottom: 0; }
.task-detail-body { flex: 1; min-width: 0; }
.task-detail-title { font-weight: 600; font-size: .82rem; color: var(--text); }
.task-detail-meta  { font-size: .74rem; color: var(--text-muted); margin: 2px 0 6px; }

/* ══════════════════════════════════════════════
   ALERTS & MESSAGES
   ══════════════════════════════════════════════ */
.alert { border-radius: var(--radius); border: none; font-size: .85rem; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger  { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info    { background: #dbeafe; color: #1d4ed8; }

/* Empty states */
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; opacity: .3; margin-bottom: 1rem; display: block; }
.empty-state p { font-size: .875rem; margin: 0; }

/* ══════════════════════════════════════════════
   AVATAR CIRCLE
   ══════════════════════════════════════════════ */
.avatar-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem;
}

/* Priority dot */
.priority-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 4px;
}
.priority-dot.low    { background: #94a3b8; }
.priority-dot.medium { background: var(--warning); }
.priority-dot.high   { background: var(--danger); }

/* ══════════════════════════════════════════════
   MOBILE / RESPONSIVE
   ══════════════════════════════════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 299;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-area { margin-left: 0 !important; }
  .login-left  { display: none; }
  .login-right { width: 100%; }
}

@media (max-width: 576px) {
  .page-content { padding: 1rem; }
  .stat-grid    { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .stat-value   { font-size: 1.4rem; }
}

/* ══════════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════════ */
.text-accent  { color: var(--accent) !important; }
.text-primary-crm { color: var(--primary) !important; }
.fw-600 { font-weight: 600 !important; }
.gap-8  { gap: 8px !important; }
.scrollable-table { overflow-x: auto; }

/* Page section separator */
.section-row {
  display: grid; gap: 1.25rem;
}
.section-row.col-2 { grid-template-columns: 1fr 1fr; }
.section-row.col-3 { grid-template-columns: 1fr 1fr 1fr; }

@media (max-width: 768px) {
  .section-row.col-2,
  .section-row.col-3 { grid-template-columns: 1fr; }
}

/* Search + filter bar */
.filter-bar {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.filter-bar .form-control,
.filter-bar .form-select { max-width: 200px; height: 38px; font-size: .8rem; }
.filter-bar .btn { height: 38px; font-size: .8rem; }

/* Timeline/feed */
.activity-feed { list-style: none; padding: 0; margin: 0; }
.activity-item {
  display: flex; gap: 12px;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; color: #fff; flex-shrink: 0;
}
.activity-body { flex: 1; }
.activity-text { font-size: .8rem; color: var(--text); line-height: 1.4; }
.activity-time { font-size: .7rem; color: var(--text-muted); margin-top: 2px; }
