/* Admin panel styles — веб-версия приложения Склад */

:root {
  --sidebar-bg: #2c3e50;
  --sidebar-fg: #ecf0f1;
  --sidebar-active: #3498db;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --header-bg: #34495e;
  --header-fg: #fff;
  --content-bg: #f4f6f8;
  --card-bg: #fff;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #6c757d;
  --primary: #3498db;
  --primary-hover: #2980b9;
  --success: #27ae60;
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --warning: #f39c12;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  height: 100%;
  width: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--content-bg);
  width: 100%;
  min-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#main-layout {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s ease, min-width 0.2s ease;
  overflow: hidden;
}

#main-layout.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  padding: 0;
  border: none;
}

.sidebar-brand {
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.sidebar-nav a {
  display: block;
  padding: 0.5rem 1.25rem;
  color: var(--sidebar-fg);
  text-decoration: none;
  transition: background 0.15s;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
}

.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: #fff;
}

.sidebar-nav .sub {
  padding-left: 1.75rem;
  font-size: 0.9rem;
  color: rgba(236, 240, 241, 0.85);
}

.sidebar-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer button,
.sidebar-footer a.btn-logout {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--sidebar-fg);
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  border-radius: 6px;
  font-family: inherit;
}

.sidebar-footer button:hover,
.sidebar-footer a.btn-logout:hover {
  background: rgba(231, 76, 60, 0.2);
  border-color: var(--danger);
  color: #fff;
}

/* Main area */
.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-header {
  background: var(--header-bg);
  color: var(--header-fg);
  padding: 1rem 1.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: var(--header-fg);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}

#main-layout.sidebar-collapsed .sidebar-toggle {
  background: rgba(255, 255, 255, 0.2);
}

.page-header-title {
  flex: 1;
  min-width: 0;
}

.content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

/* Cards and sections */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-header {
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.card-body {
  padding: 1rem;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
}

table.data-table th,
table.data-table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data-table th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
}

table.data-table tr:hover td {
  background: #f8f9fa;
}

table.data-table a {
  color: var(--primary);
  text-decoration: none;
}

table.data-table a:hover {
  text-decoration: underline;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

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

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

.btn-secondary {
  background: #6c757d;
  color: #fff;
}

.btn-secondary:hover {
  background: #5a6268;
}

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

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

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

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: #f8f9fa;
}

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

/* Utilities */
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1rem; }
.text-muted { color: var(--text-muted); font-size: 0.9rem; }
.text-right { text-align: right; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.empty-state p { margin-bottom: 0.5rem; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
}

.badge-new { background: #e3f2fd; color: #1976d2; }
.badge-shipped, .badge-in_transit { background: #fff3e0; color: #e65100; }
.badge-ready { background: #e8f5e9; color: #2e7d32; }
.badge-delivered { background: #e0f2f1; color: #00695c; }
.badge-cancelled { background: #ffebee; color: #c62828; }

/* Item thumbnail */
.item-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  background: #f0f0f0;
}

.item-thumb-lg {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  background: #f0f0f0;
}

/* Login screen (full page, no sidebar) */
body.login-page {
  display: block;
  overflow: auto;
  background: var(--sidebar-bg);
}

.login-box {
  max-width: 360px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.login-box h1 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  text-align: center;
  color: var(--text);
}

.login-box .form-group { margin-bottom: 1.25rem; }

.login-box .btn {
  width: 100%;
  padding: 0.65rem;
  margin-top: 0.5rem;
}

.login-error {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #ffebee;
  color: #c62828;
  border-radius: 6px;
  font-size: 0.9rem;
  display: none;
}

.login-error.visible { display: block; }

/* Responsive: hide sidebar on small screens, show hamburger if needed later */
@media (max-width: 768px) {
  .sidebar { width: 200px; min-width: 200px; }
  .content { padding: 1rem; }
}
