/**
 * Sharma Hub - Client Tracker Styles
 * Clean, modern UI inspired by the provided screenshots
 */

/* ===== CSS RESET & BASE ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Primary colors */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  
  /* Status colors */
  --status-received: #f59e0b;
  --status-review: #3b82f6;
  --status-entry: #8b5cf6;
  --status-sign: #06b6d4;
  --status-filing: #10b981;
  --status-completed: #22c55e;
  
  /* Semantic colors */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  
  /* Neutral colors */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Layout */
  --nav-height: 60px;
  --sidebar-width: 280px;
  --border-radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-800);
  background: var(--gray-50);
  min-height: 100vh;
}

/* ===== NAVIGATION ===== */
.navbar {
  background: white;
  height: var(--nav-height);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
  text-decoration: none;
}

.navbar-brand .logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
}

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

.nav-link {
  padding: 8px 16px;
  border-radius: var(--border-radius);
  color: var(--gray-600);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.nav-link.active {
  background: var(--primary);
  color: white;
}

/* ===== LAYOUT ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--gray-500);
}

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
}

.card-body {
  padding: 0;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-200);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-rush {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-status {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.status-received { background: #fef3c7; color: #92400e; }
.status-review { background: #dbeafe; color: #1e40af; }
.status-entry { background: #ede9fe; color: #5b21b6; }
.status-sign { background: #cffafe; color: #155e75; }
.status-filing { background: #d1fae5; color: #065f46; }
.status-completed { background: #dcfce7; color: #166534; }

.request-open { background: #fee2e2; color: #991b1b; }
.request-closed { background: #d1fae5; color: #065f46; }

/* ===== PIZZA TRACKER (STEPPER) ===== */
.tracker {
  padding: 32px 0;
}

.tracker-steps {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  padding: 0 24px;
}

.tracker-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  z-index: 1;
}

.tracker-step::before {
  content: '';
  position: absolute;
  top: 24px;
  left: 50%;
  right: -50%;
  height: 2px;
  background: var(--gray-200);
  z-index: -1;
}

.tracker-step:last-child::before {
  display: none;
}

.tracker-step.completed::before {
  background: var(--success);
}

.tracker-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gray-100);
  border: 3px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 12px;
  transition: all 0.3s;
}

.tracker-step.completed .tracker-icon {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.tracker-step.current .tracker-icon {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.tracker-step.upcoming .tracker-icon {
  background: white;
  border-color: var(--gray-300);
  color: var(--gray-400);
}

.tracker-label {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  max-width: 100px;
  line-height: 1.3;
}

.tracker-step.completed .tracker-label,
.tracker-step.current .tracker-label {
  color: var(--gray-900);
  font-weight: 600;
}

.tracker-time {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ===== TICKET HEADER ===== */
.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  padding: 20px;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.ticket-info h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.ticket-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.ticket-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--gray-600);
}

.ticket-meta-item strong {
  color: var(--gray-900);
}

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

/* ===== GRID LAYOUTS ===== */
.grid {
  display: grid;
  gap: 20px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ===== TABLES ===== */
.table-container {
  overflow-x: auto;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

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

thead {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  color: var(--gray-700);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  cursor: pointer;
  transition: background 0.2s;
}

tbody tr:hover {
  background: var(--gray-50);
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-900);
  background: white;
  transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.input-group {
  display: flex;
  gap: 8px;
}

/* ===== LISTS ===== */
.list {
  list-style: none;
}

.list-item {
  padding: 12px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.list-item-content {
  flex: 1;
}

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

.list-item-title {
  font-weight: 500;
  color: var(--gray-900);
  font-size: 14px;
}

.list-item-time {
  font-size: 12px;
  color: var(--gray-500);
}

.list-item-text {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.5;
}

/* ===== FILES ===== */
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.file-item:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.file-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  color: white;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.file-details {
  flex: 1;
}

.file-name {
  font-weight: 500;
  color: var(--gray-900);
  font-size: 14px;
  margin-bottom: 2px;
}

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

/* ===== REQUESTS ===== */
.request-item {
  padding: 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  margin-bottom: 12px;
  background: white;
}

.request-item.open {
  border-left: 3px solid var(--error);
}

.request-item.closed {
  border-left: 3px solid var(--success);
  opacity: 0.7;
}

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

.request-text {
  font-size: 14px;
  color: var(--gray-700);
  margin-bottom: 8px;
  line-height: 1.5;
}

.request-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--gray-500);
}

/* ===== NOTES FEED ===== */
.notes-feed {
  max-height: 400px;
  overflow-y: auto;
}

.note-item {
  padding: 12px;
  border-left: 3px solid var(--gray-200);
  margin-bottom: 12px;
  background: var(--gray-50);
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.note-item.by-system { border-left-color: var(--info); }
.note-item.by-manager { border-left-color: var(--primary); }
.note-item.by-preparer { border-left-color: var(--success); }
.note-item.by-client { border-left-color: var(--warning); }

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

.note-author {
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-900);
  text-transform: capitalize;
}

.note-time {
  font-size: 11px;
  color: var(--gray-500);
}

.note-text {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.5;
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal.open {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  flex-shrink: 0;
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--gray-900);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

/* Legacy side-panel class names for backward compatibility */
.side-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.side-panel.open {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}

.side-panel-header {
  padding: 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  flex-shrink: 0;
}

.side-panel-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--gray-900);
}

.side-panel-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.side-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.side-panel-overlay.show {
  opacity: 1;
  pointer-events: all;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
  position: fixed;
  bottom: -100px;
  right: 24px;
  background: var(--gray-900);
  color: white;
  padding: 16px 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  transition: bottom 0.3s ease;
  max-width: 400px;
  font-size: 14px;
}

.toast.show {
  bottom: 24px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--error); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

/* ===== FILTERS & SEARCH ===== */
.filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.search-box {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-box input {
  padding-left: 36px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 14px;
  color: var(--gray-500);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .side-panel {
    width: 100%;
    right: -100%;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }
  
  .navbar {
    padding: 0 16px;
  }
  
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .tracker-steps {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
  }
  
  .tracker-step {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
  }
  
  .tracker-step::before {
    display: none;
  }
  
  .tracker-step::after {
    content: '';
    position: absolute;
    left: 24px;
    top: 60px;
    bottom: -12px;
    width: 2px;
    background: var(--gray-200);
  }
  
  .tracker-step:last-child::after {
    display: none;
  }
  
  .tracker-step.completed::after {
    background: var(--success);
  }
  
  .tracker-label {
    text-align: left;
    max-width: none;
  }
  
  .ticket-header {
    flex-direction: column;
    gap: 16px;
  }
  
  .ticket-actions {
    width: 100%;
  }
  
  .ticket-actions .btn {
    flex: 1;
  }
  
  table {
    font-size: 12px;
  }
  
  th, td {
    padding: 8px;
  }
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-bold { font-weight: 600; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

.hidden { display: none; }
