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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --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;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 8px;
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e5e7eb;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --border-color: #e5e7eb;
}

[data-theme="dark"] {
  --gray-50: #1f2937;
  --gray-100: #1f2937;
  --gray-200: #374151;
  --gray-300: #4b5563;
  --gray-400: #6b7280;
  --gray-500: #9ca3af;
  --gray-600: #d1d5db;
  --gray-700: #e5e7eb;
  --gray-800: #f3f4f6;
  --gray-900: #f9fafb;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;
  --text-primary: #f9fafb;
  --text-secondary: #d1d5db;
  --border-color: #4b5563;
}

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

body {
  background: var(--bg-primary, var(--gray-100));
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-primary, var(--gray-800));
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 80px;
}

*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.navbar {
  background: var(--bg-secondary, white);
  box-shadow: var(--shadow);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
}

.navbar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.navbar-left,
.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.navbar-divider {
  width: 1px;
  height: 24px;
  background: var(--gray-200);
}

.navbar-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  gap: 5px;
  padding: 8px;
  border-radius: var(--radius);
}

.hamburger:hover {
  background: var(--gray-100);
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--gray-700);
  transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--gray-100);
}

.lang-toggle {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  font-weight: 600;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.lang-toggle:hover {
  background: var(--gray-200);
}

@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .navbar-left,
  .navbar-right {
    display: none;
  }

  .navbar-container {
    justify-content: flex-start;
  }

  .nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
  }

  .nav-overlay.active {
    display: block;
  }

  .navbar-nav {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary, white);
    flex-direction: column;
    padding: 60px 20px 20px;
    gap: 8px;
    z-index: 99;
    transition: left 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  }

  .navbar-nav.active {
    left: 0;
    display: flex;
  }

  .navbar-nav li {
    width: 100%;
    text-align: left;
  }

  .navbar-nav .btn {
    width: 100%;
    justify-content: center;
  }

  .nav-user {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: var(--gray-100);
    border-radius: var(--radius);
    margin-bottom: 8px;
  }

  #last-update {
    font-size: 11px;
    color: var(--gray-500);
    padding: 4px 0;
  }

  .nav-link {
    padding: 12px 16px;
    border-radius: var(--radius);
  }

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

  .theme-toggle {
    width: 100%;
    text-align: center;
    padding: 12px;
  }
}

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

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

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gray-700);
  font-weight: 500;
}

.global-stats-banner {
  background: var(--gray-800);
  color: white;
  padding: 12px 0;
  font-size: 14px;
}

.global-stats-banner strong {
  color: white;
}

.site-footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 13px;
  background: var(--gray-800);
  color: var(--gray-400);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

.site-footer p {
  margin: 4px 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--gray-300);
}

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

.btn-success:hover {
  background: #059669;
}

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

.btn-danger:hover {
  background: #dc2626;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color, var(--gray-300));
  color: var(--text-primary, var(--gray-700));
}

.btn-outline:hover {
  background: var(--gray-100);
}

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

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
}

.card-body {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

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

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color, var(--gray-300));
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-secondary, white);
  color: var(--text-primary, var(--gray-800));
  transition: all 0.2s;
}

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

.form-input::placeholder {
  color: var(--gray-400);
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

.search-box {
  position: relative;
}

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

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.5;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-value.success { color: var(--success); }
.stat-value.warning { color: var(--warning); }
.stat-value.danger { color: var(--danger); }

.stat-label {
  color: var(--text-secondary, var(--gray-500));
  font-size: 14px;
  font-weight: 500;
}

.chart-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.chart-label {
  min-width: 80px;
  font-size: 13px;
}

.chart-track {
  flex: 1;
  height: 20px;
  background: var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
}

.chart-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.5s ease-out;
}

.chart-fill.urgent { background: linear-gradient(90deg, #ef4444, #dc2626); }
.chart-fill.high { background: linear-gradient(90deg, #f97316, #ea580c); }
.chart-fill.normal { background: linear-gradient(90deg, #eab308, #ca8a04); }
.chart-fill.low { background: linear-gradient(90deg, #22c55e, #16a34a); }
.chart-fill.general { background: linear-gradient(90deg, #6366f1, #4f46e5); }
.chart-fill.technical { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }
.chart-fill.billing { background: linear-gradient(90deg, #10b981, #059669); }
.chart-fill.suggestion { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.chart-fill.bug { background: linear-gradient(90deg, #ec4899, #db2777); }
.chart-fill.other { background: linear-gradient(90deg, #6b7280, #4b5563); }

.chart-value {
  min-width: 30px;
  text-align: right;
  font-weight: 600;
  font-size: 14px;
}

.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-item {
  background: white;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color, var(--gray-200));
  cursor: pointer;
  transition: all 0.2s;
}

.ticket-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

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

.ticket-id {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
}

.ticket-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.ticket-status.open {
  background: #fef3c7;
  color: #92400e;
}

.ticket-status.closed {
  background: #d1fae5;
  color: #065f46;
}

.ticket-title {
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 4px;
}

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

.ticket-description {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.5;
}

.ticket-response {
  margin-top: 12px;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius);
  border-left: 3px solid var(--success);
}

.ticket-response-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.ticket-response-text {
  font-size: 14px;
  color: var(--gray-700);
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .two-columns {
    grid-template-columns: 1fr;
  }
  .navbar-nav {
    gap: 10px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gray-600);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

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

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-500);
}

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

.empty-state-text {
  font-size: 14px;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .count {
  background: var(--gray-200);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
}

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: var(--bg-secondary, white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 40px;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  font-size: 2rem;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary, var(--gray-800));
  margin-bottom: 4px;
}

.auth-subtitle {
  color: var(--text-secondary, var(--gray-500));
  font-size: 14px;
}

.stats-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
  padding: 8px 16px;
  border-radius: 50px;
  margin-top: 16px;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.stats-badge-icon {
  font-size: 18px;
}

.stats-badge strong {
  font-size: 18px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color, var(--gray-200));
  font-size: 14px;
  color: var(--text-secondary, var(--gray-500));
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color, var(--gray-200));
  margin-bottom: 24px;
}

.tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.tab.active {
  color: var(--primary);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
}

.tab:hover:not(.active) {
  color: var(--gray-700);
}

.page-header {
  padding: 32px 0;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 8px;
}

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

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-tab {
  padding: 10px 20px;
  background: var(--bg-secondary, white);
  border: 1px solid var(--border-color, var(--gray-200));
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--text-primary, var(--gray-600));
  cursor: pointer;
  transition: all 0.2s;
}

.admin-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.admin-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

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

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

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

.skeleton-text.medium {
  width: 80%;
}

.skeleton-line {
  height: 60px;
  margin-bottom: 12px;
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

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

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

.pull-to-refresh {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  font-weight: 600;
  transform: translateY(-100%);
  transition: transform 0.3s;
  z-index: 1000;
}

.pull-to-refresh.active {
  transform: translateY(0);
}

.pull-to-refresh.pulling {
  transform: translateY(-50%);
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr !important;
  }
}
