/* ===================================================================
   KOPYCAT.IN – Complete Anti-Piracy Protection & Copyright Platform
   Premium SaaS UI Design System
   Subdomain: app.KopyCat.in
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@500;600;700;800;900&display=swap');

/* Default: Light / White Theme */
:root, [data-theme="light"] {
  --brand-red: #E50914;
  --brand-red-hover: #C80710;
  --brand-red-glow: rgba(229, 9, 20, 0.2);
  --brand-red-subtle: rgba(229, 9, 20, 0.08);

  --bg-body: #F8FAFC;
  --bg-sidebar: #FFFFFF;
  --bg-topbar: rgba(255, 255, 255, 0.95);
  --bg-card: #FFFFFF;
  --bg-card-hover: #F8FAFC;
  --bg-input: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-table-header: #F8FAFC;
  --bg-modal-footer: #F8FAFC;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  --border-subtle: #E2E8F0;
  --border-active: rgba(229, 9, 20, 0.4);
  --border-focus: #E50914;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', 'Inter', -apple-system, sans-serif;

  --sidebar-width: 260px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 20px rgba(229, 9, 20, 0.15);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* User Toggle: Dark Theme */
[data-theme="dark"] {
  --brand-red: #E50914;
  --brand-red-hover: #FF1E27;
  --brand-red-glow: rgba(229, 9, 20, 0.35);
  --brand-red-subtle: rgba(229, 9, 20, 0.12);

  --bg-body: #08090C;
  --bg-sidebar: #0C0E14;
  --bg-topbar: rgba(12, 14, 20, 0.85);
  --bg-card: #121520;
  --bg-card-hover: #161A28;
  --bg-input: #0E1017;
  --bg-subtle: #161A28;
  --bg-table-header: #0E1119;
  --bg-modal-footer: #0E1119;

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(229, 9, 20, 0.5);
  --border-focus: #E50914;

  --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(229, 9, 20, 0.25);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
  background: #242938;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #333A4E;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

strong, b {
  color: var(--text-primary);
}

.table-kc strong,
.table-kc a:not(.btn-kc):not(.badge-kc),
.card-kopycat strong,
.card-kopycat h1,
.card-kopycat h2,
.card-kopycat h3 {
  color: var(--text-primary);
}

/* Force Light Theme High-Contrast on all text, titles, links, and strong labels */
[data-theme="light"] h1,
[data-theme="light"] h2,
[data-theme="light"] h3,
[data-theme="light"] h4,
[data-theme="light"] strong,
[data-theme="light"] b,
[data-theme="light"] .table-kc td,
[data-theme="light"] .table-kc td strong,
[data-theme="light"] .table-kc td a:not(.btn-kc):not(.badge-kc),
[data-theme="light"] .card-kopycat strong,
[data-theme="light"] .page-title,
[data-theme="light"] .card-title-kc,
[data-theme="light"] div[style*="color: #fff"],
[data-theme="light"] strong[style*="color: #fff"],
[data-theme="light"] a[style*="color: #fff"]:not(.btn-kc):not(.badge-kc),
[data-theme="light"] span[style*="color: #fff"]:not(.badge-kc),
[data-theme="light"] label[style*="color: #fff"],
[data-theme="light"] h1[style*="color: #fff"] {
  color: var(--text-primary) !important;
}

/* App Shell Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand img {
  height: 32px;
  width: auto;
}

.sidebar-brand-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--brand-red-subtle);
  color: #FF4D56;
  border: 1px solid rgba(229, 9, 20, 0.3);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  padding: 12px 10px 4px 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--brand-red-subtle);
  color: var(--brand-red);
  font-weight: 600;
  border-left: 3px solid var(--brand-red);
}

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

.nav-item.active svg {
  opacity: 1;
  color: var(--brand-red);
}

.nav-item .badge {
  margin-left: auto;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E50914, #7F050B);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar */
.app-topbar {
  height: 68px;
  background: var(--bg-topbar);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
}

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

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.breadcrumb-area {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.breadcrumb-area a {
  color: var(--text-secondary);
  text-decoration: none;
}
.breadcrumb-area a:hover {
  color: var(--text-primary);
}

.breadcrumb-sep {
  color: var(--text-muted);
}

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

/* Page Container */
.page-container {
  padding: 28px;
  flex: 1;
}

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

.page-title {
  font-size: 24px;
  font-weight: 700;
}

.page-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Cards */
.card-kopycat {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  margin-bottom: 20px;
}

.card-kopycat:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.card-header-kc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title-kc {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Metric / Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(229, 9, 20, 0.3);
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.red { background: rgba(229, 9, 20, 0.15); color: #FF4D56; }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }
.stat-icon.amber { background: rgba(245, 158, 11, 0.15); color: #FBBF24; }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: #34D399; }
.stat-icon.purple { background: rgba(168, 85, 247, 0.15); color: #C084FC; }

.stat-content {
  flex: 1;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Buttons */
.btn-kc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.btn-kc-primary {
  background: var(--brand-red);
  color: #FFFFFF;
}
.btn-kc-primary:hover {
  background: var(--brand-red-hover);
  box-shadow: 0 0 20px var(--brand-red-glow);
  color: #FFFFFF;
}

.btn-kc-secondary {
  background: var(--bg-subtle);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}
.btn-kc-secondary:hover {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.btn-kc-outline-danger {
  background: transparent;
  border-color: rgba(229, 9, 20, 0.4);
  color: var(--brand-red);
}
.btn-kc-outline-danger:hover {
  background: var(--brand-red-subtle);
  border-color: var(--brand-red);
  color: var(--brand-red);
}

.btn-kc-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-kc-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}

.form-label-kc {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control-kc {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  transition: var(--transition);
}

.form-control-kc:focus {
  outline: none;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.2);
}

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

/* Status & Priority Badges */
.badge-kc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-kc-primary { background: rgba(59, 130, 246, 0.15); color: #60A5FA; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-kc-info { background: rgba(6, 182, 212, 0.15); color: #22D3EE; border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-kc-warning { background: rgba(245, 158, 11, 0.15); color: #FBBF24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-kc-success { background: rgba(16, 185, 129, 0.15); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-kc-danger { background: rgba(239, 68, 68, 0.15); color: #F87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-kc-secondary { background: rgba(148, 163, 184, 0.15); color: #94A3B8; border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-kc-dark { background: rgba(30, 41, 59, 0.6); color: #CBD5E1; border: 1px solid rgba(255, 255, 255, 0.1); }

/* Tables */
.table-responsive-kc {
  width: 100%;
  overflow-x: auto;
}

.table-kc {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

.table-kc th {
  background: var(--bg-table-header);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.table-kc td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.table-kc tr:hover td {
  background: var(--bg-card-hover);
}

/* Tabs */
.nav-tabs-kc {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  overflow-x: auto;
}

.nav-tab-kc {
  padding: 10px 18px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.nav-tab-kc:hover {
  color: var(--text-primary);
}

.nav-tab-kc.active {
  color: #FF4D56;
  border-bottom-color: var(--brand-red);
}

/* Timeline */
.timeline-kc {
  position: relative;
  padding-left: 28px;
}

.timeline-kc::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.timeline-item {
  position: relative;
  margin-bottom: 22px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--brand-red);
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeline-dot::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-red);
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.timeline-action {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-time {
  font-size: 11.5px;
  color: var(--text-muted);
}

.timeline-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Chat & Messages */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 480px;
  overflow-y: auto;
  padding: 10px;
}

.chat-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.5;
}

.chat-bubble.internal {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #FEF3C7;
  align-self: flex-start;
}

.chat-bubble.client-msg {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  align-self: flex-start;
}

.chat-bubble.staff-msg {
  background: rgba(229, 9, 20, 0.15);
  border: 1px solid rgba(229, 9, 20, 0.3);
  color: #FFF;
  align-self: flex-end;
}

.chat-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Modals */
.modal-backdrop-kc {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop-kc.show {
  display: flex;
}

.modal-dialog-kc {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0,0,0,0.8);
  overflow: hidden;
}

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

.modal-body-kc {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer-kc {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-modal-footer);
}

/* Toast Alerts */
.toast-container-kc {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-kc {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--brand-red);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 420px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-kc.success { border-left-color: #10B981; }
.toast-kc.error { border-left-color: #EF4444; }
.toast-kc.warning { border-left-color: #F59E0B; }
.toast-kc.info { border-left-color: #3B82F6; }

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  color: var(--text-muted);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 13.5px;
  max-width: 400px;
  margin: 0 auto 16px auto;
}

/* Responsive */
@media (max-width: 991px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
  }
  .mobile-toggle {
    display: block;
  }
}

/* Theme Toggle Button */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}
.theme-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--brand-red);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}
.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
}
:root .icon-theme-sun, [data-theme="light"] .icon-theme-sun {
  display: none !important;
}
:root .icon-theme-moon, [data-theme="light"] .icon-theme-moon {
  display: block !important;
}
[data-theme="dark"] .icon-theme-sun {
  display: block !important;
}
[data-theme="dark"] .icon-theme-moon {
  display: none !important;
}
