/* VisuaTec Admin Dashboard Styles */

:root {
  --bg-primary: #0f0f12;
  --bg-secondary: #1a1a1f;
  --bg-tertiary: #242429;
  --bg-card: #1e1e24;

  --text-primary: #ffffff;
  --text-secondary: #a0a0a8;
  --text-muted: #6b6b75;

  --accent-primary: #e27aff;
  --accent-secondary: #b050ff;
  --accent-gradient: linear-gradient(135deg, #e27aff, #b050ff);

  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  --border-color: rgba(255, 255, 255, 0.1);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);

  --sidebar-width: 260px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

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

.btn-primary {
  background: var(--accent-gradient);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(226, 122, 255, 0.4);
}

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

.btn-outline:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-primary);
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}

.btn-link:hover {
  color: var(--accent-primary);
}

/* Form Fields */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(226, 122, 255, 0.2);
}

.field small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Messages */
.error-message {
  color: var(--error);
  font-size: 13px;
  margin-bottom: 12px;
}

.success-message {
  color: var(--success);
  font-size: 13px;
  margin-bottom: 12px;
}

.loading {
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

/* ================================
   LOGIN SCREEN
   ================================ */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  background-image:
    radial-gradient(circle at 20% 80%, rgba(226, 122, 255, 0.1), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(176, 80, 255, 0.08), transparent 40%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 2px;
}

.login-header h1 span {
  color: var(--accent-primary);
}

.login-header p {
  color: var(--text-secondary);
  margin-top: 4px;
  font-size: 14px;
}

.login-form .btn {
  width: 100%;
  margin-top: 8px;
}

/* ================================
   DASHBOARD LAYOUT
   ================================ */

.dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
}

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

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
}

.sidebar-header h1 span {
  color: var(--accent-primary);
}

.sidebar-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-gradient);
  color: white;
}

.nav-icon {
  font-size: 18px;
}

.badge {
  margin-left: auto;
  background: var(--error);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

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

.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#userName {
  font-size: 14px;
  font-weight: 500;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  max-width: calc(100vw - var(--sidebar-width));
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.view-header h2 {
  font-size: 24px;
  font-weight: 600;
}

.view-header .date {
  color: var(--text-muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.search-input {
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  width: 250px;
}

.filter-select {
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
}

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

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.stat-icon.new { background: rgba(226, 122, 255, 0.2); }
.stat-icon.contacted { background: rgba(59, 130, 246, 0.2); }
.stat-icon.progress { background: rgba(245, 158, 11, 0.2); }
.stat-icon.total { background: rgba(34, 197, 94, 0.2); }

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 600;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Recent Section */
.recent-section h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.recent-list {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s ease;
}

.recent-item:last-child {
  border-bottom: none;
}

.recent-item:hover {
  background: var(--bg-tertiary);
}

.recent-info h4 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

.recent-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.recent-meta {
  text-align: right;
}

.recent-meta .status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.status-new { background: rgba(226, 122, 255, 0.2); color: var(--accent-primary); }
.status-contacted { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.status-in_progress { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.status-closed { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.status-spam { background: rgba(239, 68, 68, 0.2); color: var(--error); }

.recent-meta .time {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Data Table */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

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

.data-table th {
  text-align: left;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

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

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.data-table .services-cell {
  max-width: 200px;
}

.service-tag {
  display: inline-block;
  padding: 3px 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  font-size: 11px;
  margin: 2px;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button {
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination button.active {
  background: var(--accent-gradient);
  border-color: transparent;
}

/* Settings */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
}

.settings-section h3 {
  margin-bottom: 20px;
  font-size: 18px;
}

.settings-form .btn {
  margin-top: 8px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

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

.modal-header h3 {
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

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

.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

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

.status-buttons {
  display: flex;
  gap: 12px;
}

.detail-row {
  margin-bottom: 20px;
}

.detail-label {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 15px;
}

.detail-value.message {
  background: var(--bg-tertiary);
  padding: 16px;
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 70px;
  }

  .sidebar-header h1,
  .sidebar-header p,
  .nav-item span:not(.nav-icon),
  .user-info span {
    display: none;
  }

  .nav-item {
    justify-content: center;
  }

  .sidebar-footer {
    text-align: center;
  }

  .main-content {
    margin-left: 70px;
    max-width: calc(100vw - 70px);
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
  }

  .search-input {
    width: 100%;
  }
}

