/* ============================================
   MVMT Client Portal — Styles
   ============================================ */

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

:root {
  --black: #0D0D0D;
  --dark: #141414;
  --dark-2: #1A1A1A;
  --dark-3: #222222;
  --orange: #EE730D;
  --orange-soft: rgba(238, 115, 13, 0.08);
  --orange-mid: rgba(238, 115, 13, 0.15);
  --red: #E00914;
  --white: #FFFFFF;
  --white-soft: #F5F5F5;
  --gray: #888888;
  --gray-dark: #555555;
  --green: #22C55E;
  --blue: #3B82F6;
  --yellow: #F59E0B;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 260px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--black);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-height: 100vh;
}

::selection { background: var(--orange); color: var(--black); }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 3px; }

/* --- VIEWS --- */
.view {
  display: none;
  min-height: 100vh;
}
.view.active { display: flex; }

/* --- LOGIN --- */
.login-wrapper {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(238,115,13,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(224,9,20,0.04) 0%, transparent 50%),
    var(--black);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 48px 36px;
  background: var(--dark);
  border: 1px solid rgba(238,115,13,0.1);
  border-radius: 20px;
  text-align: center;
}

.login-logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--white), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 36px;
  letter-spacing: 0.1em;
  font-family: 'Orbitron', sans-serif;
  font-weight: 400;
  text-transform: uppercase;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 6px;
  font-family: 'Orbitron', sans-serif;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 14px 16px;
  background: var(--dark-2);
  border: 1px solid var(--dark-3);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s ease;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--orange);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--gray-dark);
}

.form-error {
  font-size: 13px;
  color: var(--red);
  min-height: 20px;
}

.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(135deg, var(--orange), var(--red));
  border: none;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(238,115,13,0.25);
}

.btn-login.loading span { opacity: 0.5; }

.btn-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  display: none;
  animation: spin 0.6s linear infinite;
}

.btn-login.loading .btn-loader { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.login-back {
  display: inline-block;
  margin-top: 24px;
  font-size: 13px;
  color: var(--gray);
  text-decoration: none;
  transition: color 0.2s;
}
.login-back:hover { color: var(--orange); }

/* --- SIDEBAR --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--dark);
  border-right: 1px solid rgba(238,115,13,0.06);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.sidebar-logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--white), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--orange);
  padding: 3px 8px;
  border: 1px solid rgba(238,115,13,0.3);
  border-radius: 4px;
  background: var(--orange-soft);
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--gray);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.nav-item:hover { background: rgba(255,255,255,0.03); color: var(--white); }
.nav-item.active { background: var(--orange-soft); color: var(--orange); }
.nav-item.active svg { stroke: var(--orange); }

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.sidebar-user {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 12px;
}

.btn-logout {
  font-size: 12px;
  color: var(--gray-dark);
  background: none;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  font-family: 'Inter', sans-serif;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* --- MAIN CONTENT --- */
.main-content {
  margin-left: var(--sidebar-w);
  padding: 32px 40px;
  flex: 1;
  min-height: 100vh;
}

.content-section { display: none; }
.content-section.active { display: block; }

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.content-header h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 24px;
  font-weight: 700;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--orange);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--black);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}
.btn-action:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(238,115,13,0.3); }
.btn-action.small { padding: 8px 14px; font-size: 12px; }
.btn-action.secondary {
  background: var(--dark-3);
  color: var(--white);
}
.btn-action.secondary:hover { background: var(--gray-dark); box-shadow: none; }
.btn-action.danger { background: var(--red); }

/* --- TABLE --- */
.table-wrapper { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  font-family: 'Orbitron', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gray);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 14px;
}

.data-table tr:hover td { background: rgba(255,255,255,0.02); }

.table-actions {
  display: flex;
  gap: 8px;
}

.table-btn {
  padding: 6px 10px;
  background: var(--dark-3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  color: var(--gray);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.table-btn:hover { border-color: var(--orange); color: var(--orange); }
.table-btn.danger:hover { border-color: var(--red); color: var(--red); }

/* --- PROJECTS GRID --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
}
.project-card:hover {
  border-color: rgba(238,115,13,0.2);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.project-card h3 {
  font-size: 16px;
  font-weight: 600;
}

.status-badge {
  font-family: 'Orbitron', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.status-planning { background: rgba(59,130,246,0.15); color: var(--blue); }
.status-design { background: var(--orange-soft); color: var(--orange); }
.status-review { background: rgba(245,158,11,0.15); color: var(--yellow); }
.status-revision { background: rgba(224,9,20,0.12); color: var(--red); }
.status-approved { background: rgba(34,197,94,0.15); color: var(--green); }
.status-completed { background: rgba(34,197,94,0.15); color: var(--green); }

.project-card-desc {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 16px;
  line-height: 1.6;
}

.project-card-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--gray-dark);
}

.project-card-meta svg { width: 14px; height: 14px; }

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* --- CLIENT HEADER --- */
.client-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,13,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(238,115,13,0.06);
}

.client-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.client-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.client-logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--white), var(--orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.client-divider { color: var(--gray-dark); }

.client-greeting {
  font-size: 14px;
  color: var(--gray);
}

.client-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

.client-projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* --- PROJECT DETAIL --- */
.project-detail-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,13,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(238,115,13,0.06);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--gray);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-back:hover { border-color: var(--orange); color: var(--orange); }

.project-detail-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

.project-detail-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.detail-section {
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius);
  padding: 24px;
}

.detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.detail-section-header h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
}

/* --- FILES GRID --- */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.file-card {
  padding: 16px;
  background: var(--dark-3);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.file-card:hover { border-color: var(--orange); }

.file-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--orange-soft);
  border-radius: 10px;
  margin-bottom: 12px;
  color: var(--orange);
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  word-break: break-all;
}

.file-meta {
  font-size: 11px;
  color: var(--gray-dark);
}

/* --- HTML PREVIEW --- */
.html-preview-frame {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
}

.html-preview-frame iframe {
  width: 100%;
  height: 600px;
  border: none;
}

/* --- COMMENTS --- */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.comment-item {
  padding: 14px 16px;
  background: var(--dark-3);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gray-dark);
}

.comment-item.admin { border-left-color: var(--orange); }

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.comment-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--orange);
}

.comment-date {
  font-size: 11px;
  color: var(--gray-dark);
}

.comment-body {
  font-size: 14px;
  color: var(--white-soft);
  line-height: 1.6;
}

.comment-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.comment-form textarea {
  flex: 1;
  padding: 12px 14px;
  background: var(--dark-3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
.comment-form textarea:focus { border-color: var(--orange); }

/* --- EMPTY STATE --- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--gray);
}
.empty-state svg { margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 15px; margin-bottom: 16px; }
.empty-state.small { padding: 32px 16px; }
.empty-hint { font-size: 13px; color: var(--gray-dark); }

/* --- MODAL --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 24px;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--dark);
  border: 1px solid rgba(238,115,13,0.1);
  border-radius: var(--radius);
  transform: translateY(20px);
  transition: transform 0.3s var(--ease);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.active .modal-card { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.modal-header h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--gray);
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--white); }

.modal-body {
  padding: 24px;
}

.modal-body .form-group {
  margin-bottom: 16px;
}

.modal-body .btn-action {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

/* --- ANALYTICS --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: cardSlideUp 0.4s var(--ease) both;
}

.stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}

.stat-icon-clients { background: rgba(59,130,246,0.12); color: var(--blue); }
.stat-icon-projects { background: var(--orange-soft); color: var(--orange); }
.stat-icon-files { background: rgba(34,197,94,0.12); color: var(--green); }
.stat-icon-comments { background: rgba(245,158,11,0.12); color: var(--yellow); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--gray);
  margin-top: 4px;
  letter-spacing: 0.05em;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.analytics-card {
  background: var(--dark-2);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius);
  padding: 24px;
  animation: sectionFade 0.5s var(--ease) both;
}

.analytics-card-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 20px;
}

/* Status chart (horizontal bars) */
.status-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-bar-label {
  font-size: 12px;
  color: var(--gray);
  width: 100px;
  flex-shrink: 0;
  text-align: right;
}

.status-bar-track {
  flex: 1;
  height: 28px;
  background: var(--dark-3);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.status-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.8s var(--ease);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--black);
  min-width: 28px;
}

.status-bar-fill.bar-planning { background: var(--blue); }
.status-bar-fill.bar-design { background: var(--orange); }
.status-bar-fill.bar-review { background: var(--yellow); }
.status-bar-fill.bar-revision { background: var(--red); }
.status-bar-fill.bar-approved { background: var(--green); }
.status-bar-fill.bar-completed { background: var(--green); }

.status-bar-count {
  font-size: 12px;
  color: var(--gray);
  width: 30px;
  text-align: right;
  flex-shrink: 0;
}

/* Activity timeline */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 340px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 13px;
  animation: commentSlide 0.3s var(--ease) both;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-dot.dot-comment { background: var(--yellow); }
.activity-dot.dot-file_upload { background: var(--green); }
.activity-dot.dot-status_change { background: var(--blue); }

.activity-text {
  flex: 1;
  color: var(--gray);
  line-height: 1.5;
}

.activity-text strong { color: var(--white); font-weight: 600; }

.activity-time {
  font-size: 11px;
  color: var(--gray-dark);
  flex-shrink: 0;
  margin-top: 2px;
}

body.light-mode .stat-card,
body.light-mode .analytics-card {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.06);
}

body.light-mode .status-bar-track { background: #E5E5E5; }
body.light-mode .activity-item { border-bottom-color: rgba(0,0,0,0.05); }

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 22px; }
  .stat-card { padding: 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* --- ANIMATIONS & TRANSITIONS --- */
.view { animation: none; }
.view.active {
  animation: viewFadeIn 0.4s var(--ease) both;
}

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

.project-card {
  animation: cardSlideUp 0.4s var(--ease) both;
}
.project-card:nth-child(1) { animation-delay: 0.05s; }
.project-card:nth-child(2) { animation-delay: 0.1s; }
.project-card:nth-child(3) { animation-delay: 0.15s; }
.project-card:nth-child(4) { animation-delay: 0.2s; }
.project-card:nth-child(5) { animation-delay: 0.25s; }
.project-card:nth-child(6) { animation-delay: 0.3s; }

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

.detail-section {
  animation: sectionFade 0.5s var(--ease) both;
}
.detail-section:nth-child(1) { animation-delay: 0.1s; }
.detail-section:nth-child(2) { animation-delay: 0.2s; }
.detail-section:nth-child(3) { animation-delay: 0.3s; }

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

.comment-item {
  animation: commentSlide 0.3s var(--ease) both;
}

@keyframes commentSlide {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.file-card {
  animation: filePop 0.3s var(--ease) both;
}

@keyframes filePop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* Skeleton loaders */
.skeleton {
  background: linear-gradient(90deg, var(--dark-3) 25%, var(--dark-2) 50%, var(--dark-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-card {
  height: 140px;
  border-radius: var(--radius);
}

.skeleton-row {
  height: 52px;
  margin-bottom: 8px;
}

.skeleton-text {
  height: 14px;
  width: 60%;
  margin-bottom: 8px;
}

.skeleton-text.short { width: 40%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Button micro-interactions */
.btn-action {
  position: relative;
  overflow: hidden;
}

.btn-action::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.2) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-action:hover::after { opacity: 1; }

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  padding: 14px 20px;
  background: var(--dark);
  border: 1px solid rgba(238,115,13,0.2);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.4s var(--ease) both;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  max-width: 360px;
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast.success { border-color: var(--green); }
.toast.success .toast-icon { color: var(--green); }
.toast.error { border-color: var(--red); }
.toast.error .toast-icon { color: var(--red); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px); }
}

/* Real-time indicator dot */
.realtime-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  margin-left: 6px;
  animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
}

/* --- DARK/LIGHT MODE --- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--dark-3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 50%;
  cursor: pointer;
  color: var(--gray);
  transition: all 0.3s ease;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--orange); color: var(--orange); }
.theme-toggle svg { transition: transform 0.4s var(--ease); }

/* Light mode overrides */
body.light-mode {
  --black: #F5F5F5;
  --dark: #FFFFFF;
  --dark-2: #F0F0F0;
  --dark-3: #E5E5E5;
  --white: #111111;
  --white-soft: #222222;
  --gray: #666666;
  --gray-dark: #999999;
  --orange-soft: rgba(238, 115, 13, 0.08);
}

body.light-mode {
  background: #F5F5F5;
  color: #111;
}

body.light-mode .login-card,
body.light-mode .sidebar,
body.light-mode .modal-card,
body.light-mode .detail-section,
body.light-mode .toast {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.08);
}

body.light-mode .project-card,
body.light-mode .file-card,
body.light-mode .comment-item {
  background: #FFFFFF;
  border-color: rgba(0,0,0,0.06);
}

body.light-mode .form-group input,
body.light-mode .form-group textarea,
body.light-mode .form-group select,
body.light-mode .comment-form textarea {
  background: #F5F5F5;
  border-color: #E0E0E0;
  color: #111;
}

body.light-mode .data-table tr:hover td { background: rgba(0,0,0,0.02); }
body.light-mode .data-table th { border-bottom-color: rgba(0,0,0,0.1); }
body.light-mode .data-table td { border-bottom-color: rgba(0,0,0,0.05); }

body.light-mode .client-header {
  background: rgba(255,255,255,0.92);
  border-bottom-color: rgba(0,0,0,0.06);
}

body.light-mode .project-detail-header {
  background: rgba(245,245,245,0.95);
  border-bottom-color: rgba(0,0,0,0.06);
}

body.light-mode .sidebar-header,
body.light-mode .sidebar-footer {
  border-color: rgba(0,0,0,0.06);
}

body.light-mode .modal-overlay { background: rgba(0,0,0,0.5); }

body.light-mode .login-logo,
body.light-mode .sidebar-logo,
body.light-mode .client-logo {
  background: linear-gradient(135deg, #111, var(--orange));
  -webkit-background-clip: text;
  background-clip: text;
}

body.light-mode ::-webkit-scrollbar-track { background: #F5F5F5; }
body.light-mode ::selection { background: var(--orange); color: #FFF; }

body.light-mode .skeleton {
  background: linear-gradient(90deg, #E5E5E5 25%, #F0F0F0 50%, #E5E5E5 75%);
  background-size: 200% 100%;
}

body.light-mode .btn-logout {
  border-color: rgba(0,0,0,0.1);
}

body.light-mode .nav-item:hover { background: rgba(0,0,0,0.03); }

body.light-mode .theme-toggle {
  background: #F0F0F0;
  border-color: rgba(0,0,0,0.1);
  color: #666;
}

body.light-mode .table-btn {
  background: #F0F0F0;
  border-color: rgba(0,0,0,0.08);
  color: #666;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open { transform: translateX(0); }

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

  .content-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .projects-grid,
  .client-projects {
    grid-template-columns: 1fr;
  }

  .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .project-detail-header {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .project-detail-main {
    padding: 20px 16px;
  }

  .client-header-inner {
    padding: 12px 16px;
  }

  .html-preview-frame iframe {
    height: 400px;
  }

  .data-table th, .data-table td {
    padding: 10px 8px;
    font-size: 12px;
  }
}
