/* ================================================================
   ORIONICS COMMAND CENTER — Batcave Theme CSS
   Complete production-ready stylesheet
   ================================================================ */

/* ----------------------------------------------------------------
   0. CUSTOM PROPERTIES
   ---------------------------------------------------------------- */
:root {
  --cc-bg: #06080f;
  --cc-bg-card: rgba(10, 15, 30, 0.85);
  --cc-bg-sidebar: #080c18;
  --cc-accent: #1e6fff;
  --cc-accent-glow: rgba(30, 111, 255, 0.3);
  --cc-accent-dim: rgba(30, 111, 255, 0.08);
  --cc-text: #c8d8f0;
  --cc-text-muted: #5a7099;
  --cc-text-bright: #ffffff;
  --cc-border: rgba(30, 111, 255, 0.15);
  --cc-success: #00e676;
  --cc-warning: #ffc107;
  --cc-danger: #ff4d6d;
  --cc-terminal-green: #00ff88;
  --cc-glass: rgba(10, 15, 30, 0.6);
  --cc-radius: 12px;

  /* Layout */
  --cc-sidebar-width: 260px;
  --cc-sidebar-collapsed: 60px;
  --cc-header-height: 60px;

  /* Fonts */
  --cc-font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --cc-font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Transitions */
  --cc-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --cc-transition-fast: 0.15s ease;
}


/* ----------------------------------------------------------------
   1. RESET & BASE
   ---------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--cc-font-ui);
  background: var(--cc-bg);
  color: var(--cc-text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--cc-accent);
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--cc-accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(6, 8, 15, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(30, 111, 255, 0.25);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 111, 255, 0.4);
}


/* ----------------------------------------------------------------
   2. SECURITY GATE — Three-layer Authentication
   ---------------------------------------------------------------- */
.cc-security-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--cc-bg);
  overflow: hidden;
}

/* Animated Grid Background */
.cc-login__bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.cc-login__grid {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image:
    linear-gradient(rgba(30, 111, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 111, 255, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridDrift 30s linear infinite;
}

@keyframes gridDrift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(60px, 60px) rotate(1deg); }
}

.cc-login__scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* --- Security Layers --- */
.cc-security-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s ease;
  pointer-events: none;
}

.cc-security-layer--active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: auto;
}

.cc-security-layer__inner {
  width: 100%;
  max-width: 520px;
  padding: 48px 40px;
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  backdrop-filter: blur(16px);
  box-shadow:
    0 0 60px rgba(30, 111, 255, 0.08),
    0 25px 80px rgba(0, 0, 0, 0.5);
  animation: loginCardIn 0.6s ease-out;
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(30px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Brand (shared across layers) --- */
.cc-login__brand {
  text-align: center;
  margin-bottom: 32px;
}

.cc-login__logo {
  font-family: var(--cc-font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cc-text-bright);
  letter-spacing: 3px;
}

.cc-accent-dot {
  color: var(--cc-accent);
  text-shadow: 0 0 20px var(--cc-accent-glow);
}

.cc-login__title {
  font-family: var(--cc-font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--cc-accent);
  letter-spacing: 6px;
  margin-top: 12px;
  text-shadow: 0 0 30px var(--cc-accent-glow);
  animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  0% { text-shadow: 0 0 20px var(--cc-accent-glow); }
  100% { text-shadow: 0 0 40px var(--cc-accent-glow), 0 0 80px rgba(30, 111, 255, 0.15); }
}

.cc-login__subtitle {
  font-size: 0.82rem;
  color: var(--cc-text-muted);
  margin-top: 8px;
  letter-spacing: 1px;
}

/* --- Puzzle System (Layer 1 & 3) --- */
.cc-puzzle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.cc-puzzle__tag {
  display: inline-block;
  background: rgba(30, 111, 255, 0.1);
  color: var(--cc-accent);
  font-family: var(--cc-font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 5px 16px;
  border-radius: 20px;
  border: 1px solid rgba(30, 111, 255, 0.2);
}

.cc-puzzle__title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--cc-text-bright);
  margin: 0;
  letter-spacing: 0.3px;
}

.cc-puzzle__hint {
  font-size: 0.85rem;
  color: var(--cc-text-muted);
  text-align: center;
  line-height: 1.5;
  margin: 0;
}

.cc-puzzle__question {
  font-size: 0.95rem;
  color: var(--cc-text-muted);
  text-align: center;
  line-height: 1.5;
  margin: 0;
}

.cc-puzzle__display {
  background: rgba(6, 8, 15, 0.8);
  border: 1px solid var(--cc-accent);
  border-radius: var(--cc-radius);
  padding: 24px 28px;
  width: 100%;
  text-align: center;
  font-family: var(--cc-font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--cc-accent);
  letter-spacing: 3px;
  line-height: 1.8;
  word-break: break-all;
  box-shadow: 0 0 24px var(--cc-accent-glow), inset 0 0 40px rgba(30, 111, 255, 0.03);
  position: relative;
}

.cc-puzzle__display::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(30, 111, 255, 0.05) 0%, transparent 50%);
  pointer-events: none;
  border-radius: inherit;
}

.cc-puzzle__input {
  width: 100%;
  padding: 14px 20px;
  background: rgba(6, 8, 15, 0.7);
  border: 1px solid var(--cc-border);
  border-radius: 8px;
  font-family: var(--cc-font-mono);
  font-size: 1.1rem;
  color: var(--cc-accent);
  text-align: center;
  letter-spacing: 4px;
  outline: none;
  transition: var(--cc-transition);
}

.cc-puzzle__input:focus {
  border-color: var(--cc-accent);
  box-shadow: 0 0 0 3px var(--cc-accent-dim), 0 0 20px var(--cc-accent-dim);
}

.cc-puzzle__input::placeholder {
  color: var(--cc-text-muted);
  letter-spacing: 1px;
  font-size: 0.9rem;
}

/* Progress Dots */
.cc-puzzle__progress {
  display: flex;
  gap: 12px;
  align-items: center;
}

.cc-puzzle__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(30, 111, 255, 0.12);
  border: 1px solid var(--cc-border);
  transition: var(--cc-transition);
}

.cc-puzzle__dot--filled {
  background: var(--cc-accent);
  border-color: var(--cc-accent);
  box-shadow: 0 0 10px var(--cc-accent-glow);
}

.cc-puzzle__error {
  font-size: 0.82rem;
  color: var(--cc-danger);
  text-align: center;
  min-height: 1em;
  display: none;
  padding: 6px 12px;
  background: rgba(255, 77, 109, 0.08);
  border: 1px solid rgba(255, 77, 109, 0.2);
  border-radius: 6px;
  animation: ccShake 0.4s ease;
}

@keyframes ccShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.cc-puzzle__action-btn {
  background: none;
  border: 1px solid var(--cc-border);
  color: var(--cc-text-muted);
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--cc-transition);
  font-family: inherit;
  letter-spacing: 0.3px;
}

.cc-puzzle__action-btn:hover {
  border-color: var(--cc-accent);
  color: var(--cc-accent);
  background: rgba(30, 111, 255, 0.06);
}

/* --- Login Form (Layer 2) --- */
.cc-login__form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.cc-login__error {
  font-size: 0.85rem;
  color: var(--cc-danger);
  text-align: center;
  min-height: 1.2em;
  padding: 0 4px;
}

.cc-login__error:empty {
  display: none;
}

.cc-login__footer {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--cc-text-muted);
  letter-spacing: 0.5px;
  z-index: 2;
}


/* ----------------------------------------------------------------
   3. FORM ELEMENTS (shared)
   ---------------------------------------------------------------- */
.cc-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.cc-input,
.cc-textarea,
.cc-select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(6, 8, 15, 0.7);
  border: 1px solid var(--cc-border);
  border-radius: 8px;
  color: var(--cc-text);
  font-size: 0.95rem;
  transition: var(--cc-transition);
}

.cc-input:focus,
.cc-textarea:focus,
.cc-select:focus {
  border-color: var(--cc-accent);
  box-shadow: 0 0 0 3px var(--cc-accent-dim), 0 0 20px var(--cc-accent-dim);
  outline: none;
}

.cc-input::placeholder,
.cc-textarea::placeholder {
  color: var(--cc-text-muted);
  opacity: 0.6;
}

.cc-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.cc-textarea--code {
  font-family: var(--cc-font-mono);
  font-size: 0.85rem;
}

.cc-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a7099' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.cc-select option {
  background: #0a0d14;
  color: var(--cc-text);
}

/* Small variants */
.cc-input--sm,
.cc-select--sm {
  padding: 8px 12px;
  font-size: 0.85rem;
}

/* Form rows */
.cc-form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.cc-form-group--half {
  flex: 1 1 calc(50% - 8px);
  min-width: 200px;
}

.cc-form-group--third {
  flex: 1 1 calc(33.333% - 12px);
  min-width: 180px;
}

.cc-form-group--inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.cc-form-group--inline label {
  white-space: nowrap;
  text-transform: none;
  font-size: 0.85rem;
}

.cc-form-hint {
  font-size: 0.78rem;
  color: var(--cc-text-muted);
  margin-top: 4px;
}

/* Checkbox */
.cc-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
}

.cc-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--cc-accent);
  cursor: pointer;
}

/* Toggle Switch */
.cc-toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
}

.cc-toggle {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cc-toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  background: rgba(30, 111, 255, 0.15);
  border-radius: 13px;
  transition: var(--cc-transition);
  flex-shrink: 0;
}

.cc-toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--cc-text-muted);
  border-radius: 50%;
  transition: var(--cc-transition);
}

.cc-toggle:checked + .cc-toggle-switch {
  background: var(--cc-accent);
}

.cc-toggle:checked + .cc-toggle-switch::after {
  left: 25px;
  background: var(--cc-text-bright);
}

/* Fieldset */
.cc-fieldset {
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding: 24px;
  margin-bottom: 20px;
  background: var(--cc-accent-dim);
}

.cc-fieldset__legend {
  font-family: var(--cc-font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cc-accent);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0 12px;
}

.cc-fieldset .cc-form-group {
  margin-bottom: 16px;
}

.cc-fieldset .cc-form-group:last-child {
  margin-bottom: 0;
}


/* ----------------------------------------------------------------
   4. BUTTONS
   ---------------------------------------------------------------- */
.cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  transition: var(--cc-transition);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.cc-btn--primary {
  background: var(--cc-accent);
  color: var(--cc-text-bright);
  border: 1px solid transparent;
}

.cc-btn--primary:hover {
  background: #3580ff;
  box-shadow: 0 0 20px var(--cc-accent-glow), 0 4px 15px rgba(30, 111, 255, 0.3);
  transform: translateY(-1px);
}

.cc-btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 0 10px var(--cc-accent-glow);
}

.cc-btn--ghost {
  background: transparent;
  color: var(--cc-text-muted);
  border: 1px solid var(--cc-border);
}

.cc-btn--ghost:hover {
  color: var(--cc-text);
  border-color: var(--cc-accent);
  background: var(--cc-accent-dim);
}

.cc-btn--danger {
  background: rgba(255, 77, 109, 0.12);
  color: var(--cc-danger);
  border: 1px solid rgba(255, 77, 109, 0.25);
}

.cc-btn--danger:hover {
  background: rgba(255, 77, 109, 0.2);
  box-shadow: 0 0 15px rgba(255, 77, 109, 0.2);
}

.cc-btn--sm {
  padding: 8px 16px;
  font-size: 0.82rem;
}

.cc-btn--full {
  width: 100%;
}

.cc-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}


/* ----------------------------------------------------------------
   5. HEADER
   ---------------------------------------------------------------- */
.cc-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--cc-header-height);
  background: rgba(8, 12, 24, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  overflow: hidden;
}

.cc-header__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cc-header__toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: var(--cc-transition);
}

.cc-header__toggle:hover {
  background: var(--cc-accent-dim);
}

.cc-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 20px;
}

.cc-hamburger span {
  display: block;
  height: 2px;
  background: var(--cc-text);
  border-radius: 1px;
  transition: var(--cc-transition);
}

.cc-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cc-header__logo {
  font-family: var(--cc-font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--cc-text-bright);
  letter-spacing: 2px;
}

.cc-header__title {
  font-family: var(--cc-font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cc-accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.85;
}

/* LIVE indicator */
.cc-header__live {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.2);
  border-radius: 20px;
  margin-left: 8px;
}

.cc-live-dot {
  width: 8px;
  height: 8px;
  background: var(--cc-success);
  border-radius: 50%;
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(0, 230, 118, 0);
  }
}

.cc-live-text {
  font-family: var(--cc-font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cc-success);
  letter-spacing: 2px;
}

.cc-header__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cc-header__user {
  font-size: 0.85rem;
  color: var(--cc-text-muted);
  font-weight: 500;
}

/* Header Scan-line */
.cc-header__scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cc-accent), transparent);
  opacity: 0.4;
  animation: scanlineSweep 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes scanlineSweep {
  0% { top: 0; opacity: 0; }
  10% { opacity: 0.4; }
  90% { opacity: 0.4; }
  100% { top: calc(var(--cc-header-height) - 1px); opacity: 0; }
}


/* ----------------------------------------------------------------
   6. SIDEBAR
   ---------------------------------------------------------------- */
.cc-sidebar {
  position: fixed;
  top: var(--cc-header-height);
  left: 0;
  bottom: 0;
  width: var(--cc-sidebar-width);
  background: var(--cc-bg-sidebar);
  border-right: 1px solid var(--cc-border);
  display: flex;
  flex-direction: column;
  z-index: 900;
  transition: var(--cc-transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.cc-sidebar__nav {
  flex: 1;
  padding: 12px 0;
}

.cc-sidebar__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.cc-sidebar__item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--cc-text-muted);
  transition: var(--cc-transition);
  position: relative;
  text-align: left;
}

.cc-sidebar__item:hover {
  color: var(--cc-text);
  background: var(--cc-accent-dim);
}

.cc-sidebar__item:hover .cc-sidebar__icon {
  color: var(--cc-accent);
  text-shadow: 0 0 10px var(--cc-accent-glow);
}

.cc-sidebar__item--active {
  color: var(--cc-text-bright);
  background: rgba(30, 111, 255, 0.12);
}

.cc-sidebar__item--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--cc-accent);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px var(--cc-accent-glow);
}

.cc-sidebar__item--active .cc-sidebar__icon {
  color: var(--cc-accent);
  text-shadow: 0 0 12px var(--cc-accent-glow);
}

.cc-sidebar__icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  transition: var(--cc-transition);
}

.cc-sidebar__label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--cc-transition);
}

.cc-sidebar__badge {
  margin-left: auto;
  background: var(--cc-danger);
  color: var(--cc-text-bright);
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--cc-font-mono);
}

.cc-sidebar__footer {
  padding: 16px;
  border-top: 1px solid var(--cc-border);
}

.cc-sidebar__version {
  font-family: var(--cc-font-mono);
  font-size: 0.72rem;
  color: var(--cc-text-muted);
  opacity: 0.5;
}

/* Sidebar Overlay (mobile) */
.cc-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 850;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--cc-transition);
}

.cc-sidebar-overlay[hidden] {
  display: none;
}

.cc-sidebar-overlay.cc-active {
  opacity: 1;
}


/* ----------------------------------------------------------------
   7. MAIN CONTENT AREA
   ---------------------------------------------------------------- */
.cc-main {
  margin-left: var(--cc-sidebar-width);
  margin-top: var(--cc-header-height);
  min-height: calc(100vh - var(--cc-header-height));
  padding: 28px;
  transition: margin-left var(--cc-transition);
}


/* ----------------------------------------------------------------
   8. SECTIONS
   ---------------------------------------------------------------- */
.cc-section {
  animation: sectionFadeIn 0.35s ease-out;
}

.cc-section[hidden] {
  display: none;
}

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

.cc-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.cc-section__title {
  font-family: var(--cc-font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cc-text-bright);
  letter-spacing: 1px;
}

.cc-section__subtitle {
  font-size: 0.88rem;
  color: var(--cc-text-muted);
  margin-top: 4px;
}

.cc-section__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* ----------------------------------------------------------------
   9. STAT CARDS
   ---------------------------------------------------------------- */
.cc-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.cc-stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  backdrop-filter: blur(12px);
  transition: var(--cc-transition);
  overflow: hidden;
}

.cc-stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--cc-accent-dim), transparent 60%);
  opacity: 0;
  transition: var(--cc-transition);
  pointer-events: none;
}

.cc-stat-card:hover {
  border-color: rgba(30, 111, 255, 0.3);
  box-shadow: 0 0 20px var(--cc-accent-glow);
  transform: translateY(-2px);
}

.cc-stat-card:hover::before {
  opacity: 1;
}

.cc-stat-card__icon {
  font-size: 1.8rem;
  color: var(--cc-accent);
  flex-shrink: 0;
  text-shadow: 0 0 10px var(--cc-accent-glow);
}

.cc-stat-card__content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.cc-stat-card__value {
  font-family: var(--cc-font-mono);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--cc-text-bright);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.cc-stat-card__label {
  font-size: 0.78rem;
  color: var(--cc-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-stat-card__trend {
  font-family: var(--cc-font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.cc-stat-card__trend--up {
  color: var(--cc-success);
  background: rgba(0, 230, 118, 0.1);
}

.cc-stat-card__trend--down {
  color: var(--cc-danger);
  background: rgba(255, 77, 109, 0.1);
}


/* ----------------------------------------------------------------
   10. CHART CARDS
   ---------------------------------------------------------------- */
.cc-charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.cc-chart-card {
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: var(--cc-transition);
}

.cc-chart-card:hover {
  border-color: rgba(30, 111, 255, 0.25);
  box-shadow: 0 0 15px rgba(30, 111, 255, 0.08);
}

.cc-chart-card--wide {
  grid-column: span 3;
}

.cc-chart-card--full {
  grid-column: span 3;
}

.cc-chart-card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--cc-border);
}

.cc-chart-card__header h3 {
  font-family: var(--cc-font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cc-text);
  letter-spacing: 0.5px;
}

.cc-chart-card__body {
  padding: 20px;
  position: relative;
  min-height: 200px;
}

.cc-chart-card__body canvas {
  width: 100% !important;
  max-height: 300px;
}

.cc-chart-card__body--tall {
  min-height: 300px;
}

.cc-chart-card__body--tall canvas {
  max-height: 400px;
}


/* ----------------------------------------------------------------
   11. BOTTOM GRID (Activity + Quick Actions)
   ---------------------------------------------------------------- */
.cc-bottom-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.cc-activity-feed,
.cc-quick-actions {
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.cc-activity-feed__header,
.cc-quick-actions__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--cc-border);
}

.cc-activity-feed__header h3,
.cc-quick-actions__header h3 {
  font-family: var(--cc-font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cc-text);
  letter-spacing: 0.5px;
}


/* ----------------------------------------------------------------
   12. TERMINAL / LOG STYLES
   ---------------------------------------------------------------- */
.cc-terminal {
  background: #0a0d14;
  padding: 16px 20px;
  max-height: 280px;
  overflow-y: auto;
  font-family: var(--cc-font-mono);
  font-size: 0.8rem;
  line-height: 1.8;
}

.cc-terminal--full {
  max-height: 600px;
  border-radius: var(--cc-radius);
  border: 1px solid var(--cc-border);
}

.cc-terminal__line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(30, 111, 255, 0.05);
  flex-wrap: wrap;
}

.cc-terminal__line:last-child {
  border-bottom: none;
}

.cc-terminal__time {
  color: var(--cc-text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.cc-terminal__msg {
  color: var(--cc-terminal-green);
}

.cc-terminal__badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.cc-terminal__badge--info {
  background: rgba(30, 111, 255, 0.15);
  color: var(--cc-accent);
}

.cc-terminal__badge--success {
  background: rgba(0, 230, 118, 0.12);
  color: var(--cc-success);
}

.cc-terminal__badge--warning {
  background: rgba(255, 193, 7, 0.12);
  color: var(--cc-warning);
}

.cc-terminal__badge--danger {
  background: rgba(255, 77, 109, 0.12);
  color: var(--cc-danger);
}


/* ----------------------------------------------------------------
   13. QUICK ACTIONS
   ---------------------------------------------------------------- */
.cc-quick-actions__list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cc-quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: var(--cc-accent-dim);
  border: 1px solid var(--cc-border);
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--cc-text);
  transition: var(--cc-transition);
  text-align: left;
}

.cc-quick-action:hover {
  background: rgba(30, 111, 255, 0.12);
  border-color: rgba(30, 111, 255, 0.3);
  transform: translateX(4px);
}

.cc-quick-action__icon {
  font-size: 1.1rem;
  color: var(--cc-accent);
  width: 24px;
  text-align: center;
}


/* ----------------------------------------------------------------
   14. DATE RANGE PICKER
   ---------------------------------------------------------------- */
.cc-date-range {
  display: flex;
  gap: 4px;
  background: rgba(6, 8, 15, 0.5);
  border: 1px solid var(--cc-border);
  border-radius: 8px;
  padding: 3px;
}

.cc-date-btn {
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  color: var(--cc-text-muted);
  transition: var(--cc-transition);
}

.cc-date-btn:hover {
  color: var(--cc-text);
  background: var(--cc-accent-dim);
}

.cc-date-btn--active {
  background: var(--cc-accent);
  color: var(--cc-text-bright);
}

.cc-date-btn--active:hover {
  background: #3580ff;
  color: var(--cc-text-bright);
}


/* ----------------------------------------------------------------
   15. REAL-TIME BAR
   ---------------------------------------------------------------- */
.cc-realtime-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(0, 230, 118, 0.05);
  border: 1px solid rgba(0, 230, 118, 0.15);
  border-radius: var(--cc-radius);
  margin-bottom: 24px;
  font-size: 0.88rem;
}

.cc-realtime-bar strong {
  font-family: var(--cc-font-mono);
  color: var(--cc-success);
  font-size: 1.1rem;
}

.cc-realtime-bar--inline {
  display: inline-flex;
  padding: 6px 16px;
  margin-bottom: 0;
  font-size: 0.82rem;
}


/* ----------------------------------------------------------------
   16. TABS
   ---------------------------------------------------------------- */
.cc-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--cc-border);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cc-tabs::-webkit-scrollbar {
  display: none;
}

.cc-tab {
  padding: 12px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--cc-text-muted);
  border-bottom: 2px solid transparent;
  transition: var(--cc-transition);
  white-space: nowrap;
  position: relative;
}

.cc-tab:hover {
  color: var(--cc-text);
}

.cc-tab--active {
  color: var(--cc-accent);
  border-bottom-color: var(--cc-accent);
}

.cc-tab-panel[hidden] {
  display: none;
}


/* ----------------------------------------------------------------
   17. EDITOR FORMS
   ---------------------------------------------------------------- */
.cc-editor-form {
  max-width: 800px;
}

.cc-editor-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--cc-border);
}

.cc-editor-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.cc-status-dot {
  width: 8px;
  height: 8px;
  background: var(--cc-text-muted);
  border-radius: 50%;
  transition: var(--cc-transition);
}

.cc-status-text {
  font-size: 0.8rem;
  color: var(--cc-text-muted);
  font-weight: 500;
}

/* Status states */
.cc-editor-status[data-status="saved"] .cc-status-dot {
  background: var(--cc-success);
  box-shadow: 0 0 6px rgba(0, 230, 118, 0.4);
}

.cc-editor-status[data-status="saved"] .cc-status-text {
  color: var(--cc-success);
}

.cc-editor-status[data-status="unsaved"] .cc-status-dot {
  background: var(--cc-warning);
  box-shadow: 0 0 6px rgba(255, 193, 7, 0.4);
}

.cc-editor-status[data-status="unsaved"] .cc-status-text {
  color: var(--cc-warning);
}

.cc-editor-status[data-status="saving"] .cc-status-dot {
  background: var(--cc-accent);
  animation: savingPulse 1s ease-in-out infinite;
}

.cc-editor-status[data-status="saving"] .cc-status-text {
  color: var(--cc-accent);
}

@keyframes savingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.cc-editor-status[data-status="error"] .cc-status-dot {
  background: var(--cc-danger);
  box-shadow: 0 0 6px rgba(255, 77, 109, 0.4);
}

.cc-editor-status[data-status="error"] .cc-status-text {
  color: var(--cc-danger);
}


/* ----------------------------------------------------------------
   18. PROJECTS
   ---------------------------------------------------------------- */
.cc-project-form-card {
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-accent);
  border-radius: var(--cc-radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: 0 0 20px var(--cc-accent-glow);
  animation: sectionFadeIn 0.3s ease-out;
}

.cc-project-form-card[hidden] {
  display: none;
}

.cc-project-form-card__title {
  font-family: var(--cc-font-mono);
  font-size: 1.1rem;
  color: var(--cc-accent);
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

.cc-projects-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cc-projects-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--cc-text-muted);
  font-size: 0.9rem;
}

.cc-project-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  backdrop-filter: blur(12px);
  transition: var(--cc-transition);
}

.cc-project-card:hover {
  border-color: rgba(30, 111, 255, 0.25);
  box-shadow: 0 0 12px rgba(30, 111, 255, 0.06);
}

.cc-project-card__drag {
  color: var(--cc-text-muted);
  cursor: grab;
  padding: 4px;
  font-size: 1.2rem;
  opacity: 0.4;
  transition: var(--cc-transition);
}

.cc-project-card__drag:hover {
  opacity: 0.8;
  color: var(--cc-accent);
}

.cc-project-card__thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--cc-accent-dim);
  border: 1px solid var(--cc-border);
  flex-shrink: 0;
}

.cc-project-card__info {
  flex: 1;
  min-width: 0;
}

.cc-project-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--cc-text-bright);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-project-card__desc {
  font-size: 0.82rem;
  color: var(--cc-text-muted);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cc-project-card__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cc-project-tag {
  font-family: var(--cc-font-mono);
  font-size: 0.68rem;
  padding: 3px 10px;
  background: var(--cc-accent-dim);
  border: 1px solid var(--cc-border);
  border-radius: 20px;
  color: var(--cc-accent);
  letter-spacing: 0.3px;
}

.cc-project-card__status {
  font-family: var(--cc-font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.cc-project-card__status--published {
  background: rgba(0, 230, 118, 0.1);
  color: var(--cc-success);
  border: 1px solid rgba(0, 230, 118, 0.2);
}

.cc-project-card__status--draft {
  background: rgba(255, 193, 7, 0.1);
  color: var(--cc-warning);
  border: 1px solid rgba(255, 193, 7, 0.2);
}

.cc-project-card__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}


/* ----------------------------------------------------------------
   19. TABLE STYLES
   ---------------------------------------------------------------- */
.cc-table-card {
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  backdrop-filter: blur(12px);
  overflow: hidden;
  margin-bottom: 24px;
}

.cc-table-card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--cc-border);
}

.cc-table-card__header h3 {
  font-family: var(--cc-font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cc-text);
  letter-spacing: 0.5px;
}

.cc-table-wrap {
  overflow-x: auto;
}

.cc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.cc-table thead {
  background: rgba(6, 8, 15, 0.5);
}

.cc-table th {
  padding: 12px 20px;
  text-align: left;
  font-family: var(--cc-font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cc-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--cc-border);
}

.cc-table td {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(30, 111, 255, 0.05);
  color: var(--cc-text);
}

.cc-table tbody tr:hover {
  background: var(--cc-accent-dim);
}

.cc-table__empty {
  text-align: center;
  color: var(--cc-text-muted);
  padding: 40px 20px !important;
}

/* Pagination */
.cc-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--cc-border);
}

.cc-pagination__btn {
  padding: 6px 14px;
  background: var(--cc-accent-dim);
  border: 1px solid var(--cc-border);
  border-radius: 6px;
  color: var(--cc-text);
  font-size: 0.9rem;
  transition: var(--cc-transition);
}

.cc-pagination__btn:hover:not(:disabled) {
  border-color: var(--cc-accent);
  background: rgba(30, 111, 255, 0.12);
}

.cc-pagination__btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.cc-pagination__info {
  font-family: var(--cc-font-mono);
  font-size: 0.8rem;
  color: var(--cc-text-muted);
}


/* ----------------------------------------------------------------
   20. SETTINGS
   ---------------------------------------------------------------- */
.cc-settings-form {
  max-width: 700px;
}

.cc-settings-card {
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding: 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
}

.cc-settings-card__title {
  font-family: var(--cc-font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cc-accent);
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}


/* ----------------------------------------------------------------
   21. FILTERS BAR
   ---------------------------------------------------------------- */
.cc-filters-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  margin-bottom: 20px;
  flex-wrap: wrap;
}


/* ----------------------------------------------------------------
   22. MESSAGES
   ---------------------------------------------------------------- */
.cc-messages-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  min-height: 500px;
}

.cc-messages-list {
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  overflow-y: auto;
  max-height: 700px;
}

.cc-message-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--cc-border);
  cursor: pointer;
  transition: var(--cc-transition);
}

.cc-message-item:hover {
  background: var(--cc-accent-dim);
}

.cc-message-item--active {
  background: rgba(30, 111, 255, 0.1);
  border-left: 3px solid var(--cc-accent);
}

.cc-message-item--empty {
  text-align: center;
  color: var(--cc-text-muted);
  padding: 60px 20px;
  cursor: default;
}

.cc-message-item--empty:hover {
  background: transparent;
}

.cc-message-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.cc-message-item__from {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--cc-text-bright);
}

.cc-message-item__date {
  font-family: var(--cc-font-mono);
  font-size: 0.72rem;
  color: var(--cc-text-muted);
}

.cc-message-item__subject {
  font-size: 0.82rem;
  color: var(--cc-text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cc-message-item__preview {
  font-size: 0.78rem;
  color: var(--cc-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status Badges */
.cc-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--cc-font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cc-badge--new {
  background: rgba(0, 230, 118, 0.12);
  color: var(--cc-success);
  border: 1px solid rgba(0, 230, 118, 0.25);
}

.cc-badge--read {
  background: rgba(30, 111, 255, 0.1);
  color: var(--cc-accent);
  border: 1px solid rgba(30, 111, 255, 0.2);
}

.cc-badge--replied {
  background: rgba(200, 216, 240, 0.08);
  color: var(--cc-text-muted);
  border: 1px solid rgba(200, 216, 240, 0.15);
}

.cc-badge--archived {
  background: rgba(90, 112, 153, 0.08);
  color: var(--cc-text-muted);
  border: 1px solid rgba(90, 112, 153, 0.15);
  opacity: 0.6;
}

/* Message Detail */
.cc-message-detail {
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  overflow: hidden;
}

.cc-message-detail__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--cc-text-muted);
  gap: 12px;
}

.cc-message-detail__icon {
  font-size: 3rem;
  opacity: 0.3;
}

.cc-message-detail__content[hidden] {
  display: none;
}

.cc-message-detail__header {
  padding: 24px;
  border-bottom: 1px solid var(--cc-border);
}

.cc-message-detail__subject {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--cc-text-bright);
  margin-bottom: 8px;
}

.cc-message-detail__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cc-message-detail__from {
  font-size: 0.85rem;
  color: var(--cc-text);
}

.cc-message-detail__date {
  font-family: var(--cc-font-mono);
  font-size: 0.78rem;
  color: var(--cc-text-muted);
}

.cc-message-detail__status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--cc-font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cc-message-detail__body {
  padding: 24px;
  font-size: 0.92rem;
  line-height: 1.7;
  min-height: 200px;
  white-space: pre-wrap;
}

.cc-message-detail__actions {
  padding: 16px 24px;
  border-top: 1px solid var(--cc-border);
  display: flex;
  gap: 8px;
}


/* ----------------------------------------------------------------
   23. MODAL
   ---------------------------------------------------------------- */
.cc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  animation: modalOverlayIn 0.2s ease;
}

.cc-modal-overlay[hidden] {
  display: none;
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cc-modal {
  width: 100%;
  max-width: 520px;
  background: var(--cc-bg-card);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  box-shadow: 0 0 60px rgba(30, 111, 255, 0.1), 0 25px 80px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.3s ease-out;
  overflow: hidden;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.cc-modal__title {
  font-family: var(--cc-font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--cc-text-bright);
  letter-spacing: 0.5px;
}

.cc-modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 1.3rem;
  color: var(--cc-text-muted);
  transition: var(--cc-transition);
}

.cc-modal__close:hover {
  background: rgba(255, 77, 109, 0.12);
  color: var(--cc-danger);
}

.cc-modal__body {
  padding: 24px;
}

.cc-modal__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(30, 111, 255, 0.05);
}

.cc-modal__row:last-child {
  border-bottom: none;
}

.cc-modal__label {
  font-size: 0.82rem;
  color: var(--cc-text-muted);
  font-weight: 500;
}

.cc-modal__value {
  font-family: var(--cc-font-mono);
  font-size: 0.88rem;
  color: var(--cc-text);
}


/* ----------------------------------------------------------------
   24. ANALYTICS CHARTS GRID
   ---------------------------------------------------------------- */
.cc-charts-grid--analytics {
  grid-template-columns: repeat(2, 1fr);
}

.cc-charts-grid--analytics .cc-chart-card--full {
  grid-column: span 2;
}


/* ----------------------------------------------------------------
   25. VISITORS TABLE ACTION BUTTONS
   ---------------------------------------------------------------- */
.cc-table .cc-btn--sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}


/* ----------------------------------------------------------------
   26. RESPONSIVE — TABLET (< 1024px)
   ---------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --cc-sidebar-width: var(--cc-sidebar-collapsed);
  }

  .cc-header__toggle {
    display: flex;
  }

  .cc-sidebar {
    width: var(--cc-sidebar-collapsed);
  }

  .cc-sidebar__label,
  .cc-sidebar__badge {
    display: none;
  }

  .cc-sidebar__item {
    justify-content: center;
    padding: 12px 0;
  }

  .cc-sidebar__item::before {
    display: none;
  }

  .cc-sidebar__icon {
    font-size: 1.3rem;
  }

  .cc-sidebar__footer {
    display: none;
  }

  .cc-sidebar__list {
    padding: 0 4px;
  }

  .cc-main {
    margin-left: var(--cc-sidebar-collapsed);
    padding: 24px 20px;
  }

  /* Stats grid 2 columns */
  .cc-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Charts grid 2 columns */
  .cc-charts-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cc-chart-card--wide,
  .cc-chart-card--full {
    grid-column: span 2;
  }

  /* Bottom grid stack */
  .cc-bottom-grid {
    grid-template-columns: 1fr;
  }

  /* Messages layout stack */
  .cc-messages-layout {
    grid-template-columns: 1fr;
  }

  .cc-messages-list {
    max-height: 300px;
  }

  /* Header spacing */
  .cc-header__title {
    display: none;
  }

  /* Analytics grid */
  .cc-charts-grid--analytics {
    grid-template-columns: 1fr;
  }

  .cc-charts-grid--analytics .cc-chart-card--full {
    grid-column: span 1;
  }
}


/* ----------------------------------------------------------------
   27. RESPONSIVE — MOBILE (< 768px)
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Sidebar as full drawer overlay */
  .cc-sidebar {
    width: var(--cc-sidebar-width);
    transform: translateX(-100%);
    z-index: 950;
    box-shadow: none;
  }

  /* Reset sidebar width for mobile to full drawer */
  .cc-sidebar {
    width: 260px;
  }

  .cc-sidebar.cc-sidebar--open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.5);
  }

  .cc-sidebar.cc-sidebar--open .cc-sidebar__label,
  .cc-sidebar.cc-sidebar--open .cc-sidebar__badge {
    display: inline;
  }

  .cc-sidebar.cc-sidebar--open .cc-sidebar__item {
    justify-content: flex-start;
    padding: 12px 16px;
  }

  .cc-sidebar.cc-sidebar--open .cc-sidebar__item::before {
    display: block;
  }

  .cc-sidebar.cc-sidebar--open .cc-sidebar__footer {
    display: block;
  }

  .cc-sidebar.cc-sidebar--open .cc-sidebar__list {
    padding: 0 8px;
  }

  .cc-main {
    margin-left: 0;
    padding: 20px 16px;
  }

  .cc-header__toggle {
    display: flex;
  }

  .cc-header__live {
    display: none;
  }

  .cc-header__user {
    display: none;
  }

  .cc-header {
    padding: 0 16px;
  }

  /* Stats grid single column */
  .cc-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* Charts grid single column */
  .cc-charts-grid {
    grid-template-columns: 1fr;
  }

  .cc-chart-card--wide,
  .cc-chart-card--full {
    grid-column: span 1;
  }

  /* Stat cards compact */
  .cc-stat-card {
    padding: 16px;
  }

  .cc-stat-card__value {
    font-size: 1.4rem;
  }

  .cc-stat-card__icon {
    font-size: 1.4rem;
  }

  /* Section header */
  .cc-section__header {
    flex-direction: column;
    gap: 12px;
  }

  .cc-section__title {
    font-size: 1.2rem;
  }

  /* Date range scroll */
  .cc-date-range {
    overflow-x: auto;
    width: 100%;
  }

  /* Filters bar wrap */
  .cc-filters-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .cc-form-group--inline {
    flex-direction: column;
    align-items: stretch;
  }

  /* Messages stack */
  .cc-messages-layout {
    grid-template-columns: 1fr;
  }

  /* Tabs scroll */
  .cc-tabs {
    gap: 2px;
  }

  .cc-tab {
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  /* Form rows stack */
  .cc-form-row {
    flex-direction: column;
    gap: 12px;
  }

  .cc-form-group--half,
  .cc-form-group--third {
    flex: 1 1 100%;
    min-width: 0;
  }

  /* Project cards compact */
  .cc-project-card {
    flex-wrap: wrap;
    gap: 12px;
  }

  .cc-project-card__drag {
    display: none;
  }

  .cc-project-card__thumb {
    width: 48px;
    height: 48px;
  }

  .cc-project-card__actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Security gate card */
  .cc-security-layer__inner {
    margin: 16px;
    padding: 32px 24px;
  }

  .cc-login__title {
    font-size: 1.3rem;
    letter-spacing: 4px;
  }

  .cc-puzzle__display {
    padding: 20px 18px;
    font-size: 1rem;
    letter-spacing: 2px;
  }

  .cc-puzzle {
    gap: 16px;
  }

  .cc-login__brand {
    margin-bottom: 24px;
  }

  /* Bottom grid */
  .cc-bottom-grid {
    grid-template-columns: 1fr;
  }

  /* Analytics grid */
  .cc-charts-grid--analytics {
    grid-template-columns: 1fr;
  }

  .cc-charts-grid--analytics .cc-chart-card--full {
    grid-column: span 1;
  }

  /* Editor actions */
  .cc-editor-actions {
    flex-wrap: wrap;
  }

  .cc-editor-status {
    width: 100%;
    margin-right: 0;
    margin-bottom: 8px;
  }
}


/* ----------------------------------------------------------------
   28. SMALL MOBILE (< 480px)
   ---------------------------------------------------------------- */
@media (max-width: 480px) {
  .cc-stats-grid {
    grid-template-columns: 1fr;
  }

  .cc-stat-card {
    padding: 14px;
  }

  .cc-stat-card__trend {
    display: none;
  }

  .cc-main {
    padding: 16px 12px;
  }

  .cc-section__title {
    font-size: 1.1rem;
  }

  .cc-security-layer__inner {
    padding: 28px 20px;
    max-width: 100%;
  }

  .cc-login__title {
    font-size: 1.1rem;
    letter-spacing: 3px;
  }

  .cc-login__logo {
    font-size: 1.2rem;
  }

  .cc-puzzle__display {
    padding: 16px 14px;
    font-size: 0.85rem;
    letter-spacing: 1px;
    line-height: 1.6;
  }

  .cc-puzzle__input {
    font-size: 0.95rem;
    letter-spacing: 2px;
  }

  .cc-puzzle__title {
    font-size: 1.1rem;
  }

  .cc-login__brand {
    margin-bottom: 20px;
  }

  .cc-header__title {
    font-size: 0.75rem;
    letter-spacing: 1px;
  }

  .cc-header__brand {
    gap: 8px;
  }

  .cc-btn--sm {
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .cc-section__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .cc-table th,
  .cc-table td {
    padding: 10px 8px;
    font-size: 0.78rem;
  }

  .cc-chart-container {
    min-height: 200px;
  }
}

/* Ultra-narrow phones */
@media (max-width: 400px) {
  .cc-security-layer__inner {
    padding: 24px 14px;
  }

  .cc-login__title {
    font-size: 0.95rem;
    letter-spacing: 2px;
  }

  .cc-login__logo {
    font-size: 1rem;
  }

  .cc-login__subtitle {
    font-size: 0.72rem;
  }

  .cc-puzzle__display {
    padding: 14px 10px;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
  }

  .cc-puzzle__input {
    font-size: 0.88rem;
    letter-spacing: 1px;
    padding: 12px 14px;
  }

  .cc-puzzle__tag {
    font-size: 0.58rem;
    padding: 4px 12px;
  }

  .cc-puzzle__title {
    font-size: 1rem;
  }

  .cc-puzzle__hint,
  .cc-puzzle__question {
    font-size: 0.78rem;
  }

  .cc-main {
    padding: 12px 8px;
  }

  .cc-stat-card {
    padding: 12px 10px;
  }

  .cc-stat-card__label {
    font-size: 0.68rem;
  }

  .cc-header {
    padding: 0 10px;
  }

  .cc-btn--primary.cc-btn--full {
    padding: 12px 16px;
    font-size: 0.88rem;
  }
}


/* ----------------------------------------------------------------
   29. ACCESSIBILITY — REDUCED MOTION
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .cc-login__grid {
    animation: none;
  }

  .cc-header__scanline {
    animation: none;
    display: none;
  }

  .cc-live-dot {
    animation: none;
    box-shadow: none;
  }
}


/* ----------------------------------------------------------------
   30. PRINT STYLES
   ---------------------------------------------------------------- */
@media print {
  .cc-login,
  .cc-sidebar,
  .cc-header,
  .cc-sidebar-overlay,
  .cc-modal-overlay {
    display: none !important;
  }

  .cc-main {
    margin: 0;
    padding: 20px;
  }

  .cc-stat-card,
  .cc-chart-card,
  .cc-table-card,
  .cc-settings-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  body {
    background: white;
    color: black;
  }
}


/* ----------------------------------------------------------------
   31. UTILITY CLASSES
   ---------------------------------------------------------------- */
[hidden] {
  display: none !important;
}

.cc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cc-text-success { color: var(--cc-success); }
.cc-text-warning { color: var(--cc-warning); }
.cc-text-danger { color: var(--cc-danger); }
.cc-text-accent { color: var(--cc-accent); }
.cc-text-muted { color: var(--cc-text-muted); }

.cc-font-mono { font-family: var(--cc-font-mono); }
