/* Admin Site Styles */

/* Base styles and resets */
:root {
  --primary-color: #0070f3;
  --primary-hover: #0051a8;
  --secondary-color: #6c757d;
  --danger-color: #dc3545;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --text-color: #333333;
  --border-color: #dee2e6;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --sidebar-width: 250px;
  --header-height: 60px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: var(--text-color);
  background-color: #f6f8fa;
  line-height: 1.6;
}

/* Layout styles */
.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background-color: white;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 10;
  box-shadow: 2px 0 10px var(--shadow-color);
}

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

.sidebar-header h1 {
  font-size: 1.5rem;
  color: var(--primary-color);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav .nav-link {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.sidebar-nav .nav-link:hover {
  background-color: var(--light-color);
  color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
  background-color: var(--primary-color);
  color: white;
}

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

.user-info {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.user-info #user-name {
  font-weight: 600;
}

.user-info #user-email {
  font-size: 0.875rem;
  color: var(--secondary-color);
  margin-top: 0.25rem;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  position: relative;
}

.main-header {
  height: var(--header-height);
  background-color: white;
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 2px 5px var(--shadow-color);
}

.main-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.user-controls {
  display: flex;
  align-items: center;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Content pages */
.content-page {
  padding: 2rem;
}

.hidden {
  display: none !important;
}

/* Login screen */
.login-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 1000; /* Higher z-index to ensure it's above everything */
}

.login-card {
  background-color: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 10px 30px var(--shadow-color);
  width: 400px;
}

.login-card h2 {
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--primary-color);
}

.login-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

/* Dashboard page styles */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px var(--shadow-color);
}

.stat-card h3 {
  font-size: 1rem;
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--primary-color);
}

/* Admin diagnostics */
.admin-diagnostics {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px var(--shadow-color);
}

.admin-diagnostics h3 {
  margin-bottom: 1rem;
}

.diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.diagnostic-item {
  background-color: var(--light-color);
  padding: 0.75rem;
  border-radius: 4px;
}

.diagnostic-item strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: var(--secondary-color);
}

.admin-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* User management page styles */
.toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1;
}

.search-box input {
  width: 100%;
  padding-right: 40px;
}

.search-box .btn-icon {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table-container {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px var(--shadow-color);
  overflow-x: auto;
}

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

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

.data-table th {
  background-color: var(--light-color);
  font-weight: 600;
}

.data-table tbody tr:hover {
  background-color: #f6f8fa;
}

.table-loading {
  text-align: center;
  padding: 2rem;
  color: var(--secondary-color);
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.active {
  background-color: #e6f4ea;
  color: #137333;
}

.status-badge.inactive {
  background-color: #f8eaec;
  color: #c5221f;
}

.status-badge.trial {
  background-color: #fef7e0;
  color: #b06000;
}

.status-badge.admin {
  background-color: #e8f0fe;
  color: #1a73e8;
}

/* Stats page styles */
.stats-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.timeframe-selector {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stats-card {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px var(--shadow-color);
}

.stats-card.wide {
  grid-column: 1 / -1;
}

.stats-chart-container {
  height: 300px;
  position: relative;
}

.chart {
  width: 100%;
  height: 100%;
}

.chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background-color: var(--light-color);
  border-radius: 4px;
  color: var(--secondary-color);
  padding: 1rem;
  text-align: center;
}

.stats-table-container {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px var(--shadow-color);
  margin-top: 1.5rem;
}

.stats-table-container h3 {
  margin-bottom: 1rem;
}

/* Settings page styles */
.settings-section {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px var(--shadow-color);
  margin-bottom: 2rem;
}

.settings-section h3 {
  margin-bottom: 1.5rem;
}

.setting-card {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

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

.setting-header h4 {
  margin: 0;
}

.setting-body {
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.api-key-input {
  flex: 1;
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  width: 500px;
  max-width: 90%;
  box-shadow: 0 10px 30px var(--shadow-color);
}

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

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--secondary-color);
}

/* Status messages */
.status-message {
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 4px;
  background-color: var(--light-color);
}

.status-message.success {
  background-color: #e6f4ea;
  color: #137333;
  border-left: 3px solid #137333;
}

.status-message.error {
  background-color: #f8eaec;
  color: #c5221f;
  border-left: 3px solid #c5221f;
}

.status-message.warning {
  background-color: #fef7e0;
  color: #b06000;
  border-left: 3px solid #b06000;
}

.status-message.info {
  background-color: #e8f0fe;
  color: #1a73e8;
  border-left: 3px solid #1a73e8;
}

.error-message {
  color: var(--danger-color);
  margin-top: 1rem;
}

/* Form elements */
.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.1);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  margin-right: 0.75rem;
}

/* Button styles */
.btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-align: center;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

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

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

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

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

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

.btn-danger:hover {
  background-color: #bd2130;
}

.btn-warning {
  background-color: var(--warning-color);
  color: #212529;
}

.btn-warning:hover {
  background-color: #e0a800;
}

.btn-small {
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .stats-overview, .stats-grid {
    grid-template-columns: 1fr;
  }
}