:root {
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.6);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.08);
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar-width: 260px;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

* {
  box-sizing: inherit;
}

button, input, select, a {
  touch-action: manipulation;
}

/* Glassmorphism utility */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 4px 24px -4px rgba(0, 0, 0, 0.2);
}

/* Base button */
.btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.25);
}

.btn:active {
  transform: translateY(0);
}

.btn-danger {
  background: var(--danger);
}
.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 8px 16px rgba(239, 68, 68, 0.25);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

/* Modern inputs */
.input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: rgba(15, 23, 42, 0.6);
}

/* Page Layout */
.app-layout {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

.page-container {
  padding: 32px;
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  animation: fadeIn 0.4s ease-out;
}

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

/* Typography adjustments */
h1, h2, h3 {
  margin-top: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2rem;
  margin-bottom: 24px;
}

p {
  color: var(--text-muted);
  line-height: 1.6;
}

/* Dashboard Grid */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.card-title {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Select option styling fix for dark mode */
select option, select.input option {
  background-color: var(--bg-dark);
  color: var(--text-main);
}

/* Responsive Split Layouts */
.split-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.split-layout .main-panel {
  flex: 2;
}

.split-layout .side-panel {
  flex: 1;
}

/* Global Mobile & Tablet Adjustments */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }
  
  .page-container {
    padding: 16px;
  }
  
  .split-layout {
    flex-direction: column-reverse; /* Usually cart is on the right, on mobile it should be on top or bottom. We'll do column so cart goes below. Actually column is default. But wait, we want the cart/forms to be easily accessible. Let's stick to flex-direction: column. */
    flex-direction: column;
  }
  
  .split-layout .main-panel,
  .split-layout .side-panel {
    width: 100%;
    flex: none !important;
    position: static !important; /* Remove sticky on mobile */
  }

  h1 { font-size: 1.5rem; margin-bottom: 16px; }
  h2 { font-size: 1.2rem; }
  
  .grid-cards {
    grid-template-columns: 1fr;
  }
  
  /* Make inline search flexboxes wrap */
  .search-bar-row {
    flex-direction: column !important;
  }
}


.sidebar {
  width: var(--sidebar-width);
  height: calc(100vh - 32px);
  margin: 16px;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 32px 24px;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -1px;
}

.text-primary {
  color: var(--primary);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 500;
}

.nav-item:hover, .nav-item.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.sidebar-footer {
  padding: 24px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

.user-role {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Mobile Topbar */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

.mobile-topbar .logo {
  font-size: 1.5rem;
  font-weight: 700;
}

.mobile-menu-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

.close-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 768px) {
  .mobile-topbar {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    z-index: 50;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    background: rgba(15, 23, 42, 0.95);
    padding-bottom: 80px; /* Safe area for mobile Safari */
  }

  .sidebar.mobile-open {
    transform: translateY(0);
    opacity: 1;
  }

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

  .sidebar-header h2 {
    font-size: 1.8rem;
  }

  .close-menu-btn {
    display: flex;
  }

  /* KARE KARE GRID MENÜ */
  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 24px;
    overflow-y: auto;
  }

  .nav-item {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    gap: 16px;
    padding: 24px 12px;
  }

  .nav-item svg {
    width: 32px;
    height: 32px;
  }
  
  .nav-item span {
    font-size: 1rem;
    font-weight: 600;
  }

  .sidebar-footer {
    display: none;
  }
}

.header {
  height: 70px;
  margin: 16px 16px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 20px;
  width: 350px;
  transition: all 0.2s;
}

.header-search:focus-within {
  border-color: var(--primary);
  background: rgba(15, 23, 42, 0.6);
}

.search-icon {
  color: var(--text-muted);
}

.header-input {
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  width: 100%;
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.badge-indicator {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

