/* ============================================================
   AMATOTECH — Ticketing Styles v3.0
============================================================ */

/* ── Page Layout ── */
.ticket-page {
  padding: 0;
  background: transparent;
  min-height: 100vh;
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.ticket-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  margin: 0 0 0.25rem;
}

.ticket-header p {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0;
}

/* ── Create Button ── */
.btn-create {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(37,99,235,0.25);
  white-space: nowrap;
}

.btn-create:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37,99,235,0.35);
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  color: #fff;
}

/* ── Stats Grid ── */
.ticket-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  box-shadow: 0 2px 8px rgba(15,23,42,0.05);
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15,23,42,0.08);
}

.stat-card .icon { font-size: 2rem; }

/* ── Ticket Container ── */
.ticket-container {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 4px 16px rgba(15,23,42,0.06);
}

/* ── Search Box ── */
.search-box {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  transition: all 0.2s ease;
  font-family: inherit;
}

.search-box:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}

/* ── Ticket Table ── */
.ticket-table {
  width: 100%;
  border-collapse: collapse;
}

.ticket-table th {
  background: #0f172a;
  color: rgba(255,255,255,0.85);
  padding: 0.85rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.ticket-table th:first-child { border-radius: 10px 0 0 10px; }
.ticket-table th:last-child  { border-radius: 0 10px 10px 0; }

.ticket-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  font-size: 0.875rem;
  color: #334155;
}

.ticket-row { transition: background 0.15s ease; }
.ticket-row:hover { background: #f5f8ff; }

/* ── Badges ── */
.badge {
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* Status */
.open     { background: #eff6ff; color: #1d4ed8; }
.progress { background: #fffbeb; color: #92400e; }
.waiting  { background: #f0f9ff; color: #075985; }
.resolved { background: #ecfdf5; color: #065f46; }
.closed   { background: #f1f5f9; color: #475569; }
.cancelled { background: #fef2f2; color: #991b1b; }

/* Priority */
.low      { background: #ecfdf5; color: #065f46; }
.medium   { background: #fffbeb; color: #92400e; }
.high     { background: #fff7ed; color: #9a3412; }
.critical { background: #fef2f2; color: #991b1b; }

/* ── Action Buttons ── */
.action {
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
  margin: 0 0.15rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.18s ease;
}

.action:hover { transform: translateY(-1px); }

.view     { background: #eff6ff; color: #2563eb; }
.view:hover { background: #dbeafe; }

.reply    { background: #ecfdf5; color: #059669; }
.reply:hover { background: #d1fae5; }

.transfer { background: #fffbeb; color: #d97706; }
.transfer:hover { background: #fef3c7; }

/* ── Loading / Empty ── */
.loading-box, .empty-box {
  text-align: center;
  padding: 3rem 1.5rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ── Card overrides ── */
.card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(15,23,42,0.05);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15,23,42,0.08);
}

.card-header {
  font-weight: 600;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
}

/* ── Buttons ── */
.btn { border-radius: 9px; font-weight: 600; }

/* ── Form Controls ── */
.form-control, .form-select {
  border-radius: 9px;
  border: 1.5px solid #e2e8f0;
  font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}

/* ── Table ── */
.table { vertical-align: middle; }

.table thead {
  background: #0f172a;
  color: rgba(255,255,255,0.85);
}

.table thead th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.85rem 1rem;
  border: none;
}

.table tbody tr:hover { background: #f5f8ff; }

/* ── Priority Badges ── */
.priority-low      { background: #ecfdf5; color: #065f46; border-radius: 9999px; padding: 0.3rem 0.7rem; font-size: 0.72rem; font-weight: 700; }
.priority-medium   { background: #fffbeb; color: #92400e; border-radius: 9999px; padding: 0.3rem 0.7rem; font-size: 0.72rem; font-weight: 700; }
.priority-high     { background: #fff7ed; color: #9a3412; border-radius: 9999px; padding: 0.3rem 0.7rem; font-size: 0.72rem; font-weight: 700; }
.priority-critical { background: #fef2f2; color: #991b1b; border-radius: 9999px; padding: 0.3rem 0.7rem; font-size: 0.72rem; font-weight: 700; }

/* ── Status Badges ── */
.status-open     { background: #eff6ff; color: #1d4ed8; border-radius: 9999px; padding: 0.3rem 0.7rem; font-size: 0.72rem; font-weight: 700; }
.status-progress { background: #fffbeb; color: #92400e; border-radius: 9999px; padding: 0.3rem 0.7rem; font-size: 0.72rem; font-weight: 700; }
.status-waiting  { background: #f0f9ff; color: #075985; border-radius: 9999px; padding: 0.3rem 0.7rem; font-size: 0.72rem; font-weight: 700; }
.status-resolved { background: #ecfdf5; color: #065f46; border-radius: 9999px; padding: 0.3rem 0.7rem; font-size: 0.72rem; font-weight: 700; }
.status-closed   { background: #f1f5f9; color: #475569; border-radius: 9999px; padding: 0.3rem 0.7rem; font-size: 0.72rem; font-weight: 700; }

/* ── Attachments ── */
.attachment-list { margin-top: 1rem; }

.attachment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: background 0.15s ease;
}

.attachment-item:hover { background: #f1f5f9; }

/* ── Conversation ── */
.reply-box {
  background: #fff;
  border-left: 4px solid #2563eb;
  border-radius: 0 12px 12px 0;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(15,23,42,0.05);
}

.reply-support { border-left-color: #059669; }
.reply-user    { border-left-color: #2563eb; }
.reply-date    { color: #94a3b8; font-size: 0.8rem; }

/* ── History ── */
.history-item {
  border-left: 3px solid #2563eb;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
  background: #f8fafc;
  border-radius: 0 10px 10px 0;
}

.history-date { color: #94a3b8; font-size: 0.8rem; }

/* ── Alerts ── */
.alert { border-radius: 10px; }

/* ── Ticket Form ── */
.ticket-form label { font-weight: 600; font-size: 0.875rem; }
.ticket-form textarea { resize: vertical; }

/* ── Animations ── */
.fade-in { animation: fadeIn 0.35s ease-in-out; }

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

/* ── Responsive ── */
@media (max-width: 768px) {
  .ticket-stats { grid-template-columns: 1fr 1fr; }
  .table { font-size: 0.8rem; }
  .ticket-header { flex-direction: column; }
  .btn-create { width: 100%; justify-content: center; }
}

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