/* 
  SEO Analytics Premium Dashboard CSS
  Modern, vibrant, and clean design system.
*/
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Color Palette */
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  
  --secondary-color: #0ea5e9;
  
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --purple-color: #8b5cf6;
  
  --bg-color: #f8fafc;
  --surface-color: #ffffff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  
  --border-color: #e2e8f0;
  
  /* Layout & Spacing */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

/* ── Layout ── */
.dashboard-wrapper {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 24px 40px;
  box-sizing: border-box;
}

/* ── Navigation (Top Bar) ── */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  margin-bottom: 32px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.top-nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-nav h1 {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-color), var(--purple-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-item {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--surface-color);
  border-color: var(--border-color);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: rgba(79, 70, 229, 0.2);
}

.nav-item.logout {
  color: var(--danger-color);
}
.nav-item.logout:hover {
  background: #fef2f2;
  border-color: rgba(239, 68, 68, 0.2);
}

/* ── UI Components ── */
.card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
  background: var(--surface-color);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* ── Form Inputs & Filters ── */
  .filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
    background: var(--surface-color);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
  }

  .filter-bar .form-group {
    flex: 1 1 0;
    min-width: 0;
  }

  .filter-bar .form-control,
  .filter-bar select {
    width: 100%;
    padding: 7px 8px;
    font-size: 0.8rem;
  }

.filter-bar > div:last-child {
    margin-left: auto;
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.filter-bar > div:last-child .btn {
    padding: 7px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.form-control, select, input[type="text"], input[type="password"] {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}

.form-control:focus, select:focus, input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* ── Modern Tables ── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  background: var(--surface-color);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.table-modern {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.table-modern th {
  background: #f8fafc;
  padding: 12px 14px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  user-select: none;
  white-space: nowrap;
}

.table-modern th.sortable {
  cursor: pointer;
  transition: background 0.2s;
}

.table-modern th.sortable:hover {
  background: #f1f5f9;
}

.table-modern td {
  padding: 10px 12px;
  font-size: 0.875rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table-modern.table-compact {
  white-space: normal;
}

.table-modern.table-compact th {
  padding: 6px 6px;
  font-size: 0.7rem;
  white-space: normal;
}

.table-modern.table-compact td {
  padding: 4px 6px;
  font-size: 0.75rem;
  white-space: normal;
  word-break: break-word;
}

.table-modern tbody tr {
  transition: background 0.15s;
}

.table-modern tbody tr:hover {
  background: var(--primary-light);
}

.table-modern tbody tr:last-child td {
  border-bottom: none;
}

/* ── Badges & Status ── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.excel-cell {
    background: #fff;
    border: 1px solid #d1d5db;
    padding: 6px 8px;
    font-size: 0.85rem;
    text-align: right;
    color: var(--text-main);
    transition: var(--transition);
}

.excel-cell:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

.editable-remark {
  padding: 8px;
  min-height: 20px;
  border-radius: var(--radius-sm);
  border: 1px dashed transparent;
  transition: var(--transition);
  outline: none;
  background: #f8fafc;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  overflow-x: hidden;
  overflow-y: auto;
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.editable-remark:focus, .editable-remark:hover {
  border-color: #cbd5e1;
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

/* Legend Box (Marked Report specific) */
.legend-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.color-box {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

/* Alerts */
.alert {
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Loader */
#loader {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-main);
  color: #fff;
  padding: 12px 24px;
  border-radius: 99px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  display: none;
  animation: fadeUp 0.3s ease;
}

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

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 16px; 
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Table Sorting Styles */
.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
}

.sort-link:hover {
    color: var(--primary-color);
}

.sort-icon {
    font-size: 0.7em;
    margin-left: 2px;
    color: var(--primary-color);
}

.sort-active {
    font-weight: 800;
    color: var(--primary-color);
}

/* ── SEOCP Admin Control Panel Layout System ── */
.app-container {
  display: flex;
  min-height: 100vh;
  background-color: #f4f6f9;
}

/* Dark Sidebar */
.app-sidebar {
  width: 240px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
  z-index: 100;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  overflow-x: hidden;
}

.app-sidebar.collapsed {
  width: 68px;
}

.sidebar-brand {
  height: 60px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.5);
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.4);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.app-sidebar.collapsed .brand-title,
.app-sidebar.collapsed .user-info,
.app-sidebar.collapsed .nav-text,
.app-sidebar.collapsed .nav-arrow {
  display: none;
}

.sidebar-user {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #334155;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.user-info {
  overflow: hidden;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: capitalize;
}

.sidebar-menu {
  list-style: none;
  padding: 16px 12px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.menu-item.active {
  background: #007bff;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.35);
  font-weight: 700;
}

.menu-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-arrow {
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.5;
}

/* Sidebar Dropdown & Submenu Styles */
.menu-dropdown {
  display: flex;
  flex-direction: column;
}

.dropdown-toggle {
  cursor: pointer;
}

.dropdown-chevron {
  margin-left: auto;
  font-size: 0.65rem;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.menu-dropdown.open .dropdown-chevron {
  transform: rotate(180deg);
}

.submenu {
  list-style: none;
  padding: 4px 0 4px 34px;
  margin: 0;
  display: none;
}

.menu-dropdown.open .submenu {
  display: block;
}

.submenu-item {
  display: block;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: #94a3b8;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.submenu-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.submenu-item.active {
  color: #38bdf8;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.12);
}

/* App Topbar & Main Wrapper */
.app-main {
  flex: 1;
  margin-left: 240px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-sidebar.collapsed + .app-main {
  margin-left: 68px;
}

.app-topbar {
  height: 60px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

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

.toggle-sidebar-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: #475569;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.toggle-sidebar-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-link {
  color: #475569;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.topbar-link:hover {
  color: #007bff;
}

.app-main-content {
  padding: 24px;
  flex: 1;
}

.content-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.content-page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.83rem;
  color: #64748b;
  font-weight: 600;
}

.breadcrumb-trail a {
  color: #007bff;
  text-decoration: none;
}

.breadcrumb-trail a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.mobile-open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0 !important;
  }
}

