/* =========================================================
   AHMAD ADVERTISER - DIGITAL MARKETING SUITE STYLES
   ========================================================= */

:root {
  --primary-color: #0f172a;
  --secondary-color: #2563eb;
  --accent-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --bg-light: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --sidebar-width: 260px;
  --border-radius: 8px;
  --box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-light);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* BUTTONS & BADGES */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}
.btn-xs {
  padding: 2px 6px;
  font-size: 0.75rem;
}
.btn-block { width: 100%; justify-content: center; }
.btn-primary { background-color: var(--secondary-color); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background-color: #e2e8f0; color: #1e293b; }
.btn-secondary:hover { background-color: #cbd5e1; }
.btn-success { background-color: var(--accent-color); color: #fff; }
.btn-danger { background-color: var(--danger-color); color: #fff; }
.btn-light { background-color: #ffffff; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-icon { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--text-muted); }
.btn-icon:hover { color: var(--secondary-color); }

.badge {
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  display: inline-block;
}
.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #e0e7ff; color: #3730a3; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* LOGIN CONTAINER */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color) 0%, #1e293b 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 400px;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.3);
}
.login-header {
  text-align: center;
  margin-bottom: 24px;
}
.login-header h2 { color: var(--primary-color); font-size: 1.5rem; margin-top: 8px; }
.login-header p { font-size: 0.85rem; color: var(--text-muted); }
.login-hint { text-align: center; margin-top: 15px; font-size: 0.8rem; color: var(--text-muted); }

/* APP LAYOUT */
.app-container {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--primary-color);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
}
.avatar-placeholder {
  width: 40px;
  height: 40px;
  background-color: var(--secondary-color);
  color: #fff;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 1rem;
}
.avatar-placeholder.small { width: 32px; height: 32px; font-size: 0.8rem; }
.brand-text h3 { font-size: 1rem; line-height: 1.2; font-weight: 700; color: #fff; }
.brand-text span { font-size: 0.7rem; color: #94a3b8; }
.sidebar-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 15px 10px;
}
.sidebar-nav ul { list-style: none; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 4px;
  transition: all 0.2s;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background-color: var(--secondary-color);
  color: #fff;
}

.sidebar-footer {
  padding: 15px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-profile-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-photo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.btn-logout {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1.1rem;
}

/* MAIN WRAPPER */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background-color: #fff;
  height: 64px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 15px;
}
.mobile-toggle { display: none; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}
.search-box {
  position: relative;
  width: 250px;
}
.search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.search-box input {
  width: 100%;
  padding: 6px 12px 6px 32px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.85rem;
  outline: none;
}
.offline-tag { font-size: 0.75rem; padding: 5px 10px; }

/* CONTENT SECTIONS */
.content-body {
  padding: 24px;
  flex: 1;
}
.app-section {
  display: none;
}
.app-section.active {
  display: block;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.section-header h2 { font-size: 1.5rem; color: var(--primary-color); }
.section-header p { font-size: 0.85rem; color: var(--text-muted); }

/* DASHBOARD BANNER */
.dashboard-banner {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: #fff;
  padding: 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 15px;
}
.dashboard-banner h2 { font-size: 1.4rem; font-weight: 700; }
.dashboard-banner p { opacity: 0.9; font-size: 0.9rem; margin-top: 4px; }
.dash-actions { display: flex; gap: 10px; }

/* CARDS & METRICS */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.metric-card {
  background: var(--card-bg);
  padding: 18px;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  display: flex;
  align-items: center;
  gap: 15px;
  border: 1px solid var(--border-color);
}
.metric-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}
.bg-blue { background-color: #3b82f6; }
.bg-purple { background-color: #8b5cf6; }
.bg-orange { background-color: #f97316; }
.bg-green { background-color: #10b981; }
.bg-teal { background-color: #14b8a6; }
.bg-indigo { background-color: #6366f1; }

.metric-data .metric-title { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.metric-data h3 { font-size: 1.3rem; margin: 2px 0; color: var(--primary-color); }

/* GRIDS */
.charts-grid, .grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.grid-2-inner {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.col-span-2 { grid-column: span 2; }

/* CARD CONTAINER */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--box-shadow);
  margin-bottom: 20px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 1rem; color: var(--primary-color); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }
.chart-box { position: relative; height: 230px; width: 100%; }

/* TABLES */
.table-responsive {
  overflow-x: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}
.table th {
  background-color: #f8fafc;
  padding: 12px 14px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.table-sm td, .table-sm th { padding: 8px 10px; font-size: 0.82rem; }
.table tr:hover { background-color: #f1f5f9; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }

/* TEAM GRID */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.team-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--box-shadow);
}
.team-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 12px;
  border: 2px solid var(--secondary-color);
}

/* FORMS & FILTERS */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-main);
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.88rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  outline: none;
  background-color: #fff;
}
.form-control:focus {
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.color-picker { height: 40px; padding: 2px; cursor: pointer; }
.image-preview-wrapper { display: flex; align-items: center; gap: 10px; }
.img-preview { width: 50px; height: 50px; object-fit: contain; border-radius: 6px; border: 1px solid var(--border-color); }
.img-preview.avatar { border-radius: 50%; object-fit: cover; }
.btn-file-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* MODALS */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal.active {
  display: flex;
}
.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-lg { max-width: 850px; }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1.1rem; color: var(--primary-color); }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #f8fafc;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* PRINTABLE INVOICE */
.printable-area {
  background: #fff;
  padding: 30px;
  color: #000;
}
.invoice-head {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid var(--secondary-color);
  padding-bottom: 15px;
  margin-bottom: 20px;
}
.invoice-logo { max-height: 60px; max-width: 180px; object-fit: contain; }

/* RESPONSIVE DESIGN */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.active { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .mobile-toggle { display: block; }
  .sidebar-close-btn { display: block; }
  .charts-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topbar { padding: 0 12px; }
  .search-box { display: none; }
  .grid-2-inner { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
}

/* PRINT MEDIA STYLES */
@media print {
  .sidebar, .topbar, .no-print, .btn, .filter-bar {
    display: none !important;
  }
  .main-wrapper { margin-left: 0 !important; }
  .content-body { padding: 0 !important; }
  .modal { position: static; display: block !important; background: none; padding: 0; }
  .modal-content { max-width: 100%; box-shadow: none; border: none; }
  .printable-area { padding: 0; }
}
