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

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

:root {
  --bg: #f3f6fb;
  --bg-card: #ffffff;
  --bg-input: #f3f5f9;
  --bg-elevated: #edf0f5;
  --border: #e0e4ec;
  --border-focus: #E85A6E;
  --text: #2c3444;
  --text-secondary: #556070;
  --text-muted: #8593a6;
  --text-dim: #b0bac8;
  --rose: #E85A6E;
  --rose-bg: rgba(232, 90, 110, 0.08);
  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.08);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.08);
  --yellow: #f59e0b;
  --yellow-bg: rgba(245, 158, 11, 0.08);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.06);
  --coral: #FF8A6B;
  --coral-bg: rgba(255, 138, 107, 0.08);
  --gradient-brand: linear-gradient(135deg, #E85A6E 0%, #FF8A6B 50%, #F472B6 100%);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  --transition: all 0.2s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============ LOGIN ============ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-container {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.06);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo { width: 56px; height: 56px; border-radius: 12px; margin-bottom: 12px; }
.login-brand h1 { font-size: 24px; font-weight: 800; color: var(--text); }
.login-brand p { font-size: 13px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; }
.login-error { background: var(--red-bg); color: var(--red); padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* ============ LANGUAGE SELECTOR ============ */
.lang-selector-login {
  position: absolute;
  top: 24px;
  right: 24px;
  display: flex;
  gap: 6px;
}
.lang-selector {
  display: flex;
  gap: 4px;
  align-items: center;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
  font-family: inherit;
}
.lang-btn:hover { border-color: var(--rose); color: var(--text); }
.lang-btn.active { border-color: var(--rose); background: var(--rose-bg); color: var(--rose); }
.flag { width: 18px; height: 13px; border-radius: 2px; object-fit: cover; }
.header-divider { width: 1px; height: 24px; background: var(--border); margin: 0 8px; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
}
.form-control:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-bg); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { cursor: pointer; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.btn-primary { background: var(--gradient-brand); color: white; box-shadow: 0 2px 8px rgba(232,90,110,0.2); }
.btn-primary:hover { box-shadow: 0 4px 16px rgba(232,90,110,0.3); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-ghost { background: none; color: var(--text-muted); padding: 8px 12px; }
.btn-ghost:hover { color: var(--rose); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }

/* ============ HEADER ============ */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-logo { width: 32px; height: 32px; border-radius: 8px; }
.header-brand { display: flex; flex-direction: column; line-height: 1.2; }
.header-brand-name { font-size: 15px; font-weight: 800; color: var(--text); }
.header-brand-sub { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-user { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

/* ============ MAIN ============ */
.main { max-width: 900px; margin: 0 auto; padding: 32px 24px; }

/* ============ CARDS ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 24px; }

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-open { background: var(--blue-bg); color: var(--blue); }
.badge-in_progress { background: var(--yellow-bg); color: var(--yellow); }
.badge-waiting_client { background: var(--coral-bg); color: var(--coral); }
.badge-resolved { background: var(--green-bg); color: var(--green); }
.badge-closed { background: var(--bg-elevated); color: var(--text-muted); }
.badge-low { background: var(--bg-elevated); color: var(--text-muted); }
.badge-medium { background: var(--blue-bg); color: var(--blue); }
.badge-high { background: var(--yellow-bg); color: var(--yellow); }
.badge-urgent { background: var(--red-bg); color: var(--red); }

/* ============ TICKET LIST ============ */
.ticket-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
  transition: background 0.15s;
}
.ticket-row:last-child { border-bottom: none; }
.ticket-row:hover { background: #f8f9fc; }
.ticket-row-main { flex: 1; min-width: 0; }
.ticket-row-title { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.ticket-row-meta { font-size: 12px; color: var(--text-muted); }
.ticket-row-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ============ TICKET DETAIL ============ */
.ticket-header { margin-bottom: 24px; }
.ticket-header h2 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.ticket-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }
.ticket-meta span { display: flex; align-items: center; gap: 4px; }

.reply-thread { margin-bottom: 24px; }
.reply {
  padding: 16px 20px;
  border-bottom: 1px solid #f0f2f5;
}
.reply:last-child { border-bottom: none; }
.reply-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.reply-sender { font-weight: 600; font-size: 13px; }
.reply-sender.staff { color: var(--rose); }
.reply-sender.client { color: var(--blue); }
.reply-time { font-size: 11px; color: var(--text-dim); }
.reply-body { font-size: 14px; color: var(--text-secondary); line-height: 1.7; white-space: pre-wrap; }

.reply-form { display: flex; flex-direction: column; gap: 12px; }
.reply-form textarea { min-height: 80px; }

/* ============ PAGE HEADER ============ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-header h1 { font-size: 22px; font-weight: 800; }
.page-header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ============ NEW TICKET ============ */
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 16px;
  cursor: pointer;
}
.back-link:hover { color: var(--rose); }

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
  .header { padding: 0 16px; }
  .main { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .ticket-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .ticket-row-right { width: 100%; justify-content: space-between; }
}
