/* ============================================================
   Custom styles - Hệ thống Trợ lý Đại biểu Quốc hội
   Enhanced UI/UX - v2.0
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  --gov-blue: hsl(220, 82%, 46%);
  --gov-blue-dark: hsl(220, 82%, 36%);
  --gov-blue-light: hsl(217, 91%, 60%);
  --gov-blue-50: hsla(220, 82%, 46%, 0.08);
  --gov-success: hsl(155, 54%, 38%);
  --gov-warning: hsl(32, 95%, 44%);
  --gov-error: hsl(0, 72%, 51%);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.07), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Global Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ---------- Form Input Styles ---------- */
.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: #fff;
  color: #1e293b;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.form-input:focus {
  outline: none;
  border-color: var(--gov-blue);
  box-shadow: 0 0 0 3px hsla(220, 82%, 46%, 0.12);
  background: #fff;
}

.form-input:hover:not(:focus) {
  border-color: #cbd5e1;
}

.form-input::placeholder {
  color: #94a3b8;
}

.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  resize: vertical;
  min-height: 100px;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  font-family: inherit;
  color: #1e293b;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--gov-blue);
  box-shadow: 0 0 0 3px hsla(220, 82%, 46%, 0.12);
}

.form-select {
  width: 100%;
  padding: 0.625rem 2rem 0.625rem 0.875rem;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background-color: white;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 1.25rem;
  appearance: none;
  -webkit-appearance: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--gov-blue);
  box-shadow: 0 0 0 3px hsla(220, 82%, 46%, 0.12);
}

/* Form group with floating label effect */
.form-group {
  position: relative;
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.375rem;
  letter-spacing: 0.01em;
}

/* ---------- Button Styles ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  text-decoration: none;
  letter-spacing: 0.015em;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.2s ease;
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.1);
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--gov-blue) 0%,
    hsl(217, 91%, 56%) 100%
  );
  color: white;
  box-shadow: 0 4px 12px hsla(220, 82%, 46%, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 16px hsla(220, 82%, 46%, 0.4);
  transform: translateY(-2px);
}

.btn-outline {
  background-color: white;
  color: var(--gov-blue);
  border: 1.5px solid var(--gov-blue-light);
  box-shadow: var(--shadow-sm);
}

.btn-outline:hover:not(:disabled) {
  background-color: #f8fafc;
  border-color: var(--gov-blue);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

/* Secondary - Xanh nhạt, nhẹ nhàng hơn */
.btn-secondary {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  color: #166534;
  border: 1px solid #bbf7d0;
  box-shadow: 0 2px 6px rgba(22, 101, 52, 0.1);
}

.btn-secondary:hover:not(:disabled) {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  border-color: #86efac;
  color: #14532d;
  box-shadow: 0 4px 12px rgba(22, 101, 52, 0.15);
  transform: translateY(-2px);
}

/* Gray - Action phụ */
.btn-gray {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  color: #475569;
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
}

.btn-gray:hover:not(:disabled) {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  color: #1e293b;
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

/* Ghost - Nền trong suốt */
.btn-ghost {
  background: transparent;
  color: var(--gov-blue);
  border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--gov-blue-50);
  color: var(--gov-blue-dark);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(
    135deg,
    var(--gov-success) 0%,
    hsl(155, 54%, 44%) 100%
  );
  color: white;
  box-shadow: 0 4px 12px hsla(155, 54%, 38%, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-success:hover:not(:disabled) {
  box-shadow: 0 6px 16px hsla(155, 54%, 38%, 0.4);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.4375rem 0.875rem;
  font-size: 0.8125rem;
  gap: 0.375rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1.0625rem;
  gap: 0.625rem;
}

/* ---------- Badge Styles ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-pending {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #78350f;
  border: 1px solid #fcd34d;
}

.badge-answered,
.badge-processed {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.badge-need-info,
.badge-rejected {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* ---------- Card Styles ---------- */
.card {
  background-color: white;
  border-radius: var(--radius);
  border: 1px solid #f1f5f9;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(to right, #f8fafc, #fff);
}

.card-content {
  padding: 1.5rem;
}

/* Stat card */
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  border: 1px solid #f1f5f9;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card-yellow::before {
  background: linear-gradient(90deg, #f59e0b, #fcd34d);
}
.stat-card-green::before {
  background: linear-gradient(90deg, #10b981, #6ee7b7);
}
.stat-card-red::before {
  background: linear-gradient(90deg, #ef4444, #fca5a5);
}
.stat-card-blue::before {
  background: linear-gradient(90deg, var(--gov-blue), var(--gov-blue-light));
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* ---------- Toggle Switch ---------- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #e2e8f0;
  transition: .25s ease;
  border-radius: 13px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(90deg, var(--gov-blue), var(--gov-blue-light));
  box-shadow: 0 0 8px hsla(220, 82%, 46%, 0.4);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* ---------- Table Styles ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: linear-gradient(to right, #f8fafc, #f1f5f9);
}

.data-table th {
  padding: 0.875rem 1.5rem;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.data-table td {
  padding: 1rem 1.5rem;
  white-space: nowrap;
  border-bottom: 1px solid #f1f5f9;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

/* ---------- Tab Styles ---------- */
.tab-link {
  transition: var(--transition);
}

.tab-active {
  color: var(--gov-blue);
  border-color: var(--gov-blue);
  border-bottom-width: 2px;
  background: var(--gov-blue-50);
}

.tab-inactive {
  color: #6b7280;
  border-color: transparent;
  border-bottom-width: 2px;
}

.tab-inactive:hover {
  color: #374151;
  border-color: #d1d5db;
  background: #f9fafb;
}

.tab-list {
  display: inline-flex;
  background-color: #f3f4f6;
  border-radius: var(--radius-sm);
  padding: 0.25rem;
}

.tab-trigger {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
}

.tab-trigger:hover {
  color: #374151;
}

.tab-trigger.active {
  background-color: white;
  color: var(--gov-blue);
  font-weight: 600;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.glass-dark {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---------- Hover Lift ---------- */
.hover-lift {
  transition: var(--transition);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

/* ---------- Gradient Utilities ---------- */
.gradient-blue {
  background: linear-gradient(
    135deg,
    hsl(220, 82%, 40%) 0%,
    hsl(217, 91%, 58%) 100%
  );
}

.gradient-green {
  background: linear-gradient(
    135deg,
    hsl(155, 54%, 32%) 0%,
    hsl(155, 54%, 50%) 100%
  );
}

.gradient-red {
  background: linear-gradient(
    135deg,
    hsl(0, 72%, 46%) 0%,
    hsl(0, 84%, 62%) 100%
  );
}

.gradient-emerald {
  background: linear-gradient(
    135deg,
    hsl(160, 60%, 30%) 0%,
    hsl(160, 60%, 50%) 100%
  );
}

/* ---------- Section divider ---------- */
.section-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #e2e8f0, transparent);
  margin: 1.5rem 0;
}

/* ---------- Animations ---------- */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.animate-fade-in-up {
  animation: fadeInUp 0.4s ease both;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.animate-slide-in-right {
  animation: slideInRight 0.3s ease both;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.animate-scale-in {
  animation: scaleIn 0.25s ease both;
}

/* Skeleton loading */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.375rem;
}

/* ---------- Alert / Message Styles ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
  animation: fadeInUp 0.3s ease both;
  position: relative;
}

.alert-success {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.alert-error {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.alert-warning {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fcd34d;
  color: #78350f;
}

.alert-info {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid #93c5fd;
  color: #1e40af;
}

/* ---------- Icon Boxes ---------- */
.icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  flex-shrink: 0;
}

.icon-box-blue {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: var(--gov-blue);
}
.icon-box-green {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: var(--gov-success);
}
.icon-box-yellow {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #d97706;
}
.icon-box-red {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #dc2626;
}
.icon-box-purple {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  color: #7c3aed;
}
.icon-box-teal {
  background: linear-gradient(135deg, #ccfbf1, #99f6e4);
  color: #0f766e;
}

/* ---------- Info Box ---------- */
.info-box {
  display: flex;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid;
}

.info-box-blue {
  background: #eff6ff;
  border-color: var(--gov-blue);
  color: #1e40af;
}

.info-box-yellow {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #78350f;
}

/* ---------- Page Header ---------- */
.page-header {
  background: linear-gradient(
    135deg,
    hsl(220, 82%, 42%) 0%,
    hsl(217, 91%, 58%) 100%
  );
  color: white;
  padding: 2rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 50%;
}

.page-header::after {
  content: "";
  position: absolute;
  bottom: -60px;
  left: -20px;
  width: 220px;
  height: 220px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

/* ---------- Response Links (urlize) ---------- */
.whitespace-pre-wrap a {
  color: var(--gov-blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease, background-color 0.2s ease;
  word-break: break-all;
}

.whitespace-pre-wrap a:hover {
  color: var(--gov-blue-dark);
  background-color: var(--gov-blue-50);
  border-radius: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .btn-lg {
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
  }
  .stat-card {
    padding: 1rem;
  }
}
