/* ========================================
   Xpi100 Performance Shop - Modern CSS
   ======================================== */

:root {
  --bg: #f0f4f8;
  --card: #ffffff;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent2: #10b981;
  --accent2-hover: #059669;
  --text: #1e293b;
  --text-light: #475569;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========================================
   Material Symbols
   ======================================== */

.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'liga';
  font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
}

.material-symbols-rounded.filled {
  font-variation-settings:
    'FILL' 1,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
}

/* ========================================
   Mobile Header
   ======================================== */

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center;
  gap: 16px;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.mobile-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.hamburger {
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition);
}

.hamburger:hover {
  background: var(--bg);
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

.close-btn {
  display: none;
  width: 36px;
  height: 36px;
  background: var(--bg);
  border: none;
  border-radius: 8px;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}

.close-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* ========================================
   Sidebar Overlay
   ======================================== */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
  opacity: 1;
}

/* ========================================
   Sidebar
   ======================================== */

.sidebar {
  width: 260px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  z-index: 999;
  overflow-y: auto;
  transition: var(--transition);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--accent);
  color: white;
  transform: translateX(4px);
}

.nav-icon {
  font-size: 1.25rem;
}

.nav-text {
  font-size: 0.95rem;
}

/* ========================================
   Sidebar User Section
   ======================================== */

.sidebar-user {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  position: absolute;
  bottom: 24px;
  left: 16px;
  right: 16px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.user-info .material-symbols-rounded {
  font-size: 28px;
  color: var(--accent);
}

.user-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.user-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-actions .nav-item {
  padding: 10px 16px;
  font-size: 0.9rem;
}

.user-actions .nav-item.logout:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ========================================
   Main Content
   ======================================== */

.content {
  margin-left: 260px;
  padding: 32px;
  min-height: 100vh;
}

.content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

/* ========================================
   Cards
   ======================================== */

.card {
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--accent);
}

.card h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card p {
  margin-bottom: 12px;
  color: var(--text-light);
}

.card p b {
  color: var(--text);
  font-weight: 600;
}

/* ========================================
   Forms
   ======================================== */

input, textarea, select {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--card);
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

button:hover, .btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn.green {
  background: var(--accent2);
}

.btn.green:hover {
  background: var(--accent2-hover);
}

/* ========================================
   Tables
   ======================================== */

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.table th, .table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg);
}

.table tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background: rgba(59, 130, 246, 0.04);
}

.table td {
  color: var(--text);
}

.table td a {
  color: var(--accent);
  text-decoration: none;
  font-size: 1.25rem;
  transition: var(--transition);
}

.table td a:hover {
  transform: scale(1.2);
}

/* ========================================
   Search
   ======================================== */

.search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

button.search-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--card) !important;
  color: var(--text-light) !important;
  cursor: pointer;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

button.search-btn .material-symbols-rounded {
  color: var(--text-light) !important;
}

button.search-btn:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.04) !important;
  transform: none;
  box-shadow: none;
}

button.search-btn:hover .material-symbols-rounded {
  color: var(--accent) !important;
}

.search-box {
  display: none;
}

.search-box input {
  margin-bottom: 0;
  min-width: 280px;
}

/* ========================================
   Utility Classes
   ======================================== */

.text-muted {
  color: var(--muted);
}

.mt-4 {
  margin-top: 1rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

/* ========================================
   RESPONSIVE - Tablet
   ======================================== */

@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }

  .content {
    margin-left: 220px;
    padding: 24px;
  }
}

/* ========================================
   RESPONSIVE - Mobile
   ======================================== */

@media (max-width: 768px) {

  /* Show mobile header */
  .mobile-header {
    display: flex;
  }

  /* Hide sidebar by default on mobile */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    padding-top: 24px;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    pointer-events: none;
  }

  .sidebar-overlay.open {
    pointer-events: auto;
  }

  .close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Adjust content */
  .content {
    margin-left: 0;
    padding: 80px 16px 24px;
  }

  .content h2 {
    font-size: 1.5rem;
    margin-bottom: 16px;
  }

  /* Cards */
  .card {
    padding: 20px;
    border-radius: var(--radius);
  }

  .card h2 {
    font-size: 1.25rem;
  }

  /* Forms */
  input, textarea, select {
    padding: 12px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  button, .btn {
    width: 100%;
    padding: 14px 20px;
  }

  /* Tables to cards on mobile */
  .table {
    display: block;
  }

  .table thead {
    display: none;
  }

  .table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .table tr {
    display: block;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: var(--transition);
  }

  .table tr:hover {
    border-color: var(--accent);
  }

  .table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border: none;
    border-bottom: 1px solid var(--border);
  }

  .table td:last-child {
    border-bottom: none;
    padding-top: 12px;
    justify-content: flex-end;
    gap: 16px;
  }

  .table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    font-size: 0.85rem;
    text-transform: uppercase;
  }

  .table td:last-child::before {
    display: none;
  }

  /* Search */
  .search-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .search-btn {
    width: 100%;
  }

  .search-box {
    width: 100%;
  }

  .search-box input {
    min-width: 100%;
  }

  /* Prevent body scroll when sidebar open */
  body.sidebar-open {
    overflow: hidden;
  }
}

/* ========================================
   RESPONSIVE - Small Mobile
   ======================================== */

@media (max-width: 380px) {
  .content {
    padding: 70px 12px 20px;
  }

  .card {
    padding: 16px;
  }

  .mobile-logo {
    font-size: 1.1rem;
  }

  .table td {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .table td::before {
    font-size: 0.75rem;
  }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  .sidebar, .mobile-header, .hamburger, .search-wrap {
    display: none !important;
  }

  .content {
    margin-left: 0;
    padding: 20px;
  }

  .table {
    display: table;
  }

  .table thead {
    display: table-header-group;
  }

  .table tbody {
    display: table-row-group;
  }

  .table tr {
    display: table-row;
  }

  .table td, .table th {
    display: table-cell;
  }
}
