@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap");

:root {
  --bg: #F9FAFB;
  --card: #ffffff;
  --txt: #222;
  --muted: #666;
  --pri: #2f6bff;
  --pri-2: #1e4dd0;
  --good: #12a150;
  --ok: #ffc400;
  --bad: #c43b3b;
  --warn: #c43b3b;
  --border: #e5e7ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--txt);
}

a {
  color: var(--pri);
  text-decoration: none;
}

.btn {
  border-radius: 8px;
}

/* Responsive Navigation */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  margin-right: 12px;
}

.nav-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-left a {
  margin-right: 14px;
  white-space: nowrap;
}

.nav-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.user-pill {
  background: #eef2ff;
  padding: 6px 10px;
  border-radius: 8px;
  margin-right: 8px;
  white-space: nowrap;
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .navbar {
    padding: 8px 12px;
  }
  
  .nav-left a {
    margin-right: 8px;
    font-size: 14px;
  }
  
  .user-pill {
    font-size: 12px;
    padding: 4px 8px;
    margin-right: 4px;
  }
  
  .btn {
    font-size: 12px;
    padding: 4px 8px;
  }
}

@media (max-width: 576px) {
  .navbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  
  .nav-left, .nav-right {
    justify-content: center;
  }
  
  .nav-left a {
    margin-right: 6px;
    font-size: 13px;
  }
}

/* Responsive Container */
.container {
  padding-left: 16px;
  padding-right: 16px;
}

@media (max-width: 576px) {
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Center Card - Login/Forms */
.center-card {
  background: var(--card);
  max-width: 420px;
  margin: 56px auto;
  padding: 24px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

@media (max-width: 576px) {
  .center-card {
    margin: 20px auto;
    padding: 16px;
    max-width: 95%;
  }
}

.center {
  text-align: center;
}

.text-muted,
.muted {
  color: var(--muted);
}

/* Responsive Grid System */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

/* Mobile Grid Adjustments */
@media (max-width: 1024px) {
  .grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .grid {
    gap: 12px;
  }
  
  .grid-5,
  .grid-4,
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .grid {
    gap: 8px;
  }
  
  .grid-5,
  .grid-4,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.mt {
  margin-top: 16px;
}

/* Responsive Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .1), 0 2px 4px -2px rgba(0, 0, 0, .1);
  transition: box-shadow 0.2s ease-in-out, border 0.05s ease-in-out;
}

.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);
}

@media (max-width: 576px) {
  .card {
    padding: 12px;
  }
}

/* KPI Cards */
.kpi .kpi-title {
  color: var(--muted);
  font-size: 14px;
}

.kpi .kpi-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 6px;
}

@media (max-width: 768px) {
  .kpi .kpi-title {
    font-size: 12px;
  }
  
  .kpi .kpi-value {
    font-size: 24px;
  }
}

@media (max-width: 576px) {
  .kpi .kpi-title {
    font-size: 11px;
  }
  
  .kpi .kpi-value {
    font-size: 20px;
  }
}

/* Form Elements */
.input,
.textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  margin-bottom: 10px;
}

.textarea {
  min-height: 120px;
}

@media (max-width: 576px) {
  .input,
  .textarea,
  select {
    padding: 8px 10px;
    font-size: 14px;
  }
  
  .textarea {
    min-height: 100px;
  }
}

label {
  display: block;
  font-size: 14px;
  margin: 6px 0;
  color: #444;
}

@media (max-width: 576px) {
  label {
    font-size: 13px;
  }
}

/* Flash Messages */
.flash-wrap {
  margin-bottom: 16px;
}

.flash {
  padding: 10px 12px;
  border-radius: 8px;
  margin: 6px 0;
}

@media (max-width: 576px) {
  .flash {
    padding: 8px 10px;
    font-size: 14px;
  }
}

.flash-success {
  background: #e6f7ee;
  border: 1px solid #b4e5c8;
}

.flash-danger {
  background: #ffe8e8;
  border: 1px solid #f5b3b3;
}

.flash-warning {
  background: #fff7e6;
  border: 1px solid #ffe3a6;
}

.flash-info {
  background: #eef2ff;
  border: 1px solid #c8d1ff;
}

/* Responsive Flex Layout */
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .row {
    gap: 8px;
    padding: 6px 0;
  }
}

@media (max-width: 576px) {
  .row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
}

.col-8 {
  flex: 8;
}

.col-4 {
  flex: 4;
}

.col-2 {
  flex: 2;
}

@media (max-width: 576px) {
  .col-8,
  .col-4,
  .col-2 {
    flex: 1;
  }
}

.right {
  text-align: right;
}

@media (max-width: 576px) {
  .right {
    text-align: left;
  }
}

.form {
  margin-top: 10px;
}

/* Customer Cards */
.customer .meta span {
  margin-right: 12px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 576px) {
  .customer .meta span {
    margin-right: 8px;
    font-size: 12px;
  }
}

.zebra:nth-child(odd) {
  background: #fafbff;
  border-radius: 6px;
}

.error {
  color: #b00020;
  font-size: 13px;
  margin-bottom: 6px;
}

/* Badges */
.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
}

@media (max-width: 576px) {
  .badge {
    padding: 3px 6px;
    font-size: 11px;
  }
}

.badge.good {
  background: #e6f7ee;
  color: var(--good);
  border: 1px solid #b4e5c8;
}

.badge.ok {
  background: #fffbe6;
  color: #ffc100;
  border: 1px solid #ffeb84;
}

.badge.bad {
  background: #fff0f0;
  color: #ff4d4d;
  border: 1px solid #ffccc7;
}

.badge.warn {
  background: #ffe8e8;
  color: var(--warn);
  border: 1px solid #f5b3b3;
}

/* Flex Between */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 768px) {
  .flex-between {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
}

/* Dashboard Specific Responsive Styles */
.dashboard-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  .dashboard-header img {
    height: 60px !important;
  }
}

@media (max-width: 576px) {
  .dashboard-header img {
    height: 50px !important;
  }
}

/* Customer List Responsive Styles */
.customer-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

@media (max-width: 576px) {
  .customer-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .customer-info img {
    height: 30px !important;
  }
}

.customer-stats {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 15px 0;
}

@media (max-width: 768px) {
  .customer-stats {
    flex-direction: column;
    gap: 8px;
  }
}

.customer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .customer-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 576px) {
  .customer-actions {
    flex-direction: column;
  }
  
  .customer-actions .btn {
    width: 100%;
    margin: 2px 0;
  }
}

/* Rankings Dashboard Responsive Styles */
.rankings-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

@media (max-width: 1024px) {
  .rankings-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.rankings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 768px) {
  .rankings-actions {
    flex-direction: column;
  }
  
  .rankings-actions .btn {
    width: 100%;
  }
}

/* Table Responsive Styles */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  min-width: 600px;
}

@media (max-width: 768px) {
  .table {
    font-size: 14px;
  }
  
  .table th,
  .table td {
    padding: 8px 4px;
  }
}

@media (max-width: 576px) {
  .table {
    font-size: 12px;
    min-width: 500px;
  }
  
  .table th,
  .table td {
    padding: 6px 3px;
  }
}

/* Rankings Table Specific */
.rankings-table-container {
  position: relative;
  overflow: hidden;
}

.query-column {
  width: 40%;
  min-width: 250px;
  flex-shrink: 0;
}

.history-column {
  flex-grow: 1;
  position: relative;
  max-width: 60%;
  overflow: hidden;
  display: flex;
  align-items: center;
}

@media (max-width: 1024px) {
  .query-column {
    width: 50%;
    min-width: 200px;
  }
  
  .history-column {
    max-width: 50%;
  }
}

@media (max-width: 768px) {
  .rankings-table-container .d-flex {
    flex-direction: column;
  }
  
  .query-column,
  .history-column {
    width: 100%;
    max-width: 100%;
  }
}

/* Search Input */
.search-container {
  margin-bottom: 15px;
}

@media (max-width: 576px) {
  .search-container .form-control {
    font-size: 14px;
  }
}

/* Performance Stats */
.performance-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  padding: 15px;
  background: var(--bg);
  border-radius: 10px;
  margin: 15px 0;
}

@media (max-width: 768px) {
  .performance-stats {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}

.performance-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Button Groups */
.btn-group-responsive {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 576px) {
  .btn-group-responsive {
    flex-direction: column;
  }
  
  .btn-group-responsive .btn {
    width: 100%;
  }
}

/* Utility Classes for Mobile */
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
  
  .show-mobile {
    display: block !important;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
  
  .show-desktop {
    display: block !important;
  }
}

/* Text Responsive */
@media (max-width: 576px) {
  h1 {
    font-size: 1.5rem;
  }
  
  h2 {
    font-size: 1.3rem;
  }
  
  h3 {
    font-size: 1.1rem;
  }
  
  h4 {
    font-size: 1rem;
  }
  
  h5 {
    font-size: 0.9rem;
  }
  
  h6 {
    font-size: 0.8rem;
  }
}

/* Spacing Adjustments for Mobile */
@media (max-width: 576px) {
  .mb-3 {
    margin-bottom: 1rem !important;
  }
  
  .mb-5 {
    margin-bottom: 2rem !important;
  }
  
  .mt-3 {
    margin-top: 1rem !important;
  }
  
  .mt-5 {
    margin-top: 2rem !important;
  }
  
  .p-3 {
    padding: 0.75rem !important;
  }
  
  .p-4 {
    padding: 1rem !important;
  }
  
  .p-5 {
    padding: 1.25rem !important;
  }
}

/* Scrollable Content */
.scrollable-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.scrollable-x::-webkit-scrollbar {
  height: 6px;
}

.scrollable-x::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.scrollable-x::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.scrollable-x::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Focus States for Accessibility */
.btn:focus,
.input:focus,
.textarea:focus,
select:focus {
  outline: 2px solid var(--pri);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --border: #000;
    --muted: #333;
  }
  
  .card {
    border-width: 2px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .navbar,
  .btn,
  .flash-wrap {
    display: none !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #000 !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}