/* Access/Developer Controller CSS */

:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--gray-100);
  color: var(--gray-700);
  min-height: 100vh;
}

.access-container {
  max-width: 1000px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.access-header {
  background: var(--white);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.school-logo {
  height: 40px;
  width: auto;
  margin-top: -6px;
}

.header-left h1 {
  font-size: 1.25rem;
  color: var(--gray-700);
  font-weight: 700;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.access-nav {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--gray-700);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--primary);
}

/* Main content */
.access-main {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Sections */
section {
  background: var(--white);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

section h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: var(--gray-700);
  margin-bottom: 1rem;
  font-weight: 600;
}

section h2 svg {
  color: var(--primary);
}

/* Settings section */
.setting-group {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.setting-item label {
  display: flex;
  flex-direction: column;
}

.setting-label {
  font-weight: 500;
  color: var(--gray-700);
}

.setting-desc {
  font-size: 0.85rem;
  color: var(--gray-500);
}

.radio-group {
  display: flex;
  gap: 1rem;
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.radio-option:hover {
  border-color: var(--primary-light);
}

.radio-option input[type="radio"] {
  accent-color: var(--primary);
}

.radio-option input[type="radio"]:checked + span {
  color: var(--primary);
  font-weight: 500;
}

.radio-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--gray-50);
}

.range-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-wrapper input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--gray-200);
  outline: none;
  accent-color: var(--primary);
}

.range-value {
  min-width: 50px;
  text-align: center;
  font-weight: 500;
  color: var(--primary);
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-wrapper input[type="number"] {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.9rem;
}

.input-wrapper input[type="number"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.input-suffix {
  color: var(--gray-500);
  font-size: 0.85rem;
}

.btn-save-settings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  background: var(--primary);
  color: white;
}

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

/* Audit section */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.btn-clear-log {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--danger);
}

.btn-clear-log:hover:not(:disabled) {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-clear-log:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.audit-log {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 1rem;
  max-height: 300px;
  overflow-y: auto;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.85rem;
}

.audit-entry {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.audit-entry:hover {
  background: var(--gray-200);
}

.audit-time {
  color: var(--gray-500);
  min-width: 150px;
}

.audit-action {
  min-width: 80px;
  text-align: center;
}

.badge-upload { background: var(--success); color: white; }
.badge-delete { background: var(--danger); color: white; }
.badge-events { background: var(--primary-light); color: white; }
.badge-settings { background: var(--warning); color: white; }
.badge-connection { background: var(--gray-500); color: white; }

.audit-details {
  color: var(--gray-700);
  flex: 1;
}

.empty-log {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--gray-500);
}

.empty-log svg {
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* Auth section */
.auth-status {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  width: fit-content;
}

.status-dev {
  background: var(--gray-100);
  color: var(--gray-700);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.auth-info {
  color: var(--gray-500);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-info strong {
  color: var(--gray-700);
}

.auth-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--gray-50);
  border-radius: 8px;
}

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

.auth-preview code {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.85rem;
  color: var(--gray-700);
  background: var(--gray-200);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

/* System section */
.system-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem;
  background: var(--gray-50);
  border-radius: 8px;
}

.info-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-value {
  font-size: 0.95rem;
  color: var(--gray-700);
  font-weight: 500;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: white;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  opacity: 0;
  transform: translateY(1rem);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--danger);
}

.toast-info {
  background: var(--primary);
}

/* Scrollbar styling */
.audit-log::-webkit-scrollbar {
  width: 6px;
}

.audit-log::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 3px;
}

.audit-log::-webkit-scrollbar-thumb {
  background: var(--gray-500);
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
  .access-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }

  .access-main {
    padding: 1rem;
  }

  .system-info {
    grid-template-columns: 1fr;
  }

  .audit-entry {
    flex-wrap: wrap;
  }

  .audit-time {
    min-width: auto;
    width: 100%;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }
}
