/* =====================================================
  Desktop Styles - Jewelry Admin Panel
  ===================================================== */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #ffffff !important;
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

/* Header */
.header {
  background: #ffffff;
  padding: 20px 30px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a202c;
  margin: 0;
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Section */
.section {
  background: #ffffff;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.section h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: #1a202c;
}

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

/* Stat Card */
.stat-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  border-left: 4px solid #667eea;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 14px;
  color: #718096;
  font-weight: 500;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  width: 80px;
  text-align: center;
}

.badge-success {
  background: #c6f6d5;
  color: #22543d;
}

.badge-warning {
  background: #feebc8;
  color: #744210;
}

.badge-danger {
  background: #fed7d7;
  color: #742a2a;
}

.badge-info {
  background: #bee3f8;
  color: #2c5282;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

thead {
  background: #f7fafc;
}

th {
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  color: #4a5568;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e2e8f0;
}

td {
  padding: 12px 15px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 14px;
}

tbody tr:hover {
  background: #f7fafc;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.btn-success {
  background: #48bb78;
  color: white;
}

.btn-success:hover {
  background: #38a169;
}

.btn-danger {
  background: #f56565;
  color: white;
}

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

.btn-outline {
  background: #ffffff;
  color: #333;
  border: 1px solid #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-outline:hover {
  background: #f7fafc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Actions in tables */
.actions {
  display: flex;
  gap: 8px;
}

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

/* Tabs */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0;
}

.tab {
  padding: 12px 24px;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: #718096;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab:hover {
  color: #4a5568;
}

.tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal h3 {
  font-size: 20px;
  margin-bottom: 20px;
  color: #1a202c;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #4a5568;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #667eea;
}

/* Login Form */
.login-form {
  max-width: 400px;
  margin: 100px auto;
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.login-form h2 {
  font-size: 24px;
  margin-bottom: 25px;
  text-align: center;
  color: #1a202c;
}

.login-form .error {
  background: #fed7d7;
  color: #742a2a;
  padding: 12px 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.chart-container {
  background: white;
  border-radius: 10px;
  padding: 20px;
  height: 300px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Service Card specific */
.service-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .header {
    padding: 15px 15px;
  }

  .header h1 {
    font-size: 18px;
  }

  .header .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .section {
    padding: 15px;
  }

  .section h2 {
    font-size: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 12px;
  }

  /* Карточка сервиса - стек на мобильных */
  .stat-card > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr 1fr;
  }

  /* Кнопка Reset и бейдж статуса */
  .stat-card > div[style*="text-align: right"] {
    text-align: left;
    margin-top: 10px;
  }

  .tabs {
    flex-wrap: wrap;
    gap: 5px;
  }

  .tab {
    padding: 8px 12px;
    font-size: 13px;
  }

  table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  th, td {
    padding: 8px 10px;
  }

  .actions {
    flex-direction: column;
    gap: 5px;
  }

  .actions .btn {
    width: 100%;
    padding: 8px;
  }

  .chart-container {
    height: 200px !important;
  }

  .modal {
    width: 95%;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 5px;
  }

  .header {
    padding: 12px 12px;
    margin-bottom: 10px;
  }

  .header h1 {
    font-size: 16px;
  }

  .header > div {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header .btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  .section {
    padding: 12px;
    margin-bottom: 10px;
  }

  .section h2 {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-label {
    font-size: 11px;
  }

  /* Сервисы - одна колонка на очень маленьких экранах */
  .stats-grid[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  .stat-card > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .tabs {
    gap: 3px;
  }

  .tab {
    padding: 8px 10px;
    font-size: 12px;
    flex: 1;
    text-align: center;
  }

  table {
    font-size: 11px;
  }

  th, td {
    padding: 6px 8px;
  }

  .login-form {
    margin: 10px auto;
    padding: 20px 15px;
  }

  .login-form h2 {
    font-size: 18px;
  }

  .login-form .btn {
    width: 100%;
  }

  .modal {
    width: 98%;
    padding: 15px;
  }

  .modal h3 {
    font-size: 16px;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .chart-container {
    height: 180px !important;
  }
}

/* Dark mode адаптация для мобильных */
@media (max-width: 768px) {
  body.dark-mode .header {
    padding: 15px 15px;
  }

  body.dark-mode .section {
    padding: 15px;
  }
}

@media (max-width: 480px) {
  body.dark-mode .header {
    padding: 12px 12px;
  }

  body.dark-mode .section {
    padding: 12px;
  }
}

/* =====================================================
   Dark Mode (VS Code Style)
   ===================================================== */
body.dark-mode {
  background: #1e1e1e !important;
  color: #cccccc;
}

body.dark-mode .header,
body.dark-mode .section,
body.dark-mode .stat-card,
body.dark-mode .chart-container,
body.dark-mode .login-form,
body.dark-mode .modal {
  background: #252526;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

body.dark-mode .header h1,
body.dark-mode .section h2,
body.dark-mode .section h3 {
  color: #cccccc;
}

body.dark-mode th {
  background: #1e1e1e;
  color: #9cdcfe;
}

body.dark-mode td {
  border-bottom-color: #3c3c3c;
  color: #cccccc;
}

body.dark-mode tbody tr:hover {
  background: #2a2d2e;
}

body.dark-mode .form-group input {
  background: #3c3c3c;
  border-color: #3c3c3c;
  color: #cccccc;
}

body.dark-mode .form-group input:focus {
  border-color: #007acc;
}

body.dark-mode .form-group label {
  color: #cccccc;
}

body.dark-mode .badge-success {
  background: #2d4a2d;
  color: #89d185;
}

body.dark-mode .badge-warning {
  background: #4a3c1e;
  color: #d7ba7d;
}

body.dark-mode .badge-danger {
  background: #4a2d2d;
  color: #f48771;
}

body.dark-mode .badge-info {
  background: #1e3a4a;
  color: #569cd6;
}

body.dark-mode .btn-outline {
  background: #252526;
  color: #cccccc;
  border-color: #3c3c3c;
}

body.dark-mode .btn-outline:hover {
  background: #2a2d2e;
  border-color: #007acc;
}

body.dark-mode .stat-value {
  color: #569cd6;
}

body.dark-mode .stat-label {
  color: #808080;
}

body.dark-mode .tab {
  color: #808080;
}

body.dark-mode .tab.active {
  color: #569cd6;
  border-bottom-color: #569cd6;
}

body.dark-mode .modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

body.dark-mode .modal {
  color: #cccccc;
}

body.dark-mode ::-webkit-scrollbar-track {
  background: #1e1e1e;
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: #424242;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: #4f4f4f;
}

body.dark-mode .btn-primary {
  background: #007acc;
  color: #ffffff;
}

body.dark-mode .btn-primary:hover {
  background: #005a9e;
}

body.dark-mode .btn-success {
  background: #4ec9b0;
  color: #1e1e1e;
}

body.dark-mode .btn-success:hover {
  background: #3db59a;
}

body.dark-mode .btn-danger {
  background: #f48771;
  color: #1e1e1e;
}

body.dark-mode .btn-danger:hover {
  background: #e0755f;
}
