
/* /static/style.css */
:root {
  --primary-color: #1976d2;
  --primary-hover: #1565c0;
  --secondary-color: #28a745;
  --danger-color: #dc3545;
  --info-color: #17a2b8;
  --light-bg: #f5f5f5;
  --dark-bg: #343a40;
  --card-shadow: 0 2px 5px rgba(0,0,0,0.1);
  --card-hover-shadow: 0 4px 8px rgba(0,0,0,0.15);
  --border-radius: 6px;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--light-bg);
  color: #333;
}

.center-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #fff;
  box-shadow: var(--card-shadow);
  margin: 1rem auto;
  padding: 2rem;
  border-radius: var(--border-radius);
  max-width: 500px;
}

input, button, textarea, select {
  margin: 0.5rem 0;
  padding: 0.7rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

button {
  cursor: pointer;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  transition: background-color 0.2s;
}

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

nav.navbar {
  display: flex;
  background-color: var(--dark-bg);
  padding: 0.8rem 1rem;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

nav.navbar button {
  background: none;
  border: none;
  color: #fff;
  margin-right: 1rem;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.2s;
  width: auto;
}

nav.navbar #adminButtons {
  display: inline-flex;
}

nav.navbar button:hover {
  background-color: rgba(255,255,255,0.1);
}

nav.navbar button.active {
  background-color: rgba(255,255,255,0.2);
  font-weight: bold;
}

nav.navbar .uuid-display {
  margin-left: auto;
  color: #ccc;
  font-size: 0.9rem;
}

.content-area {
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.key-list, .user-list {
  list-style: none;
  padding: 0;
}

.key-list li, .user-list li {
  background: #fff;
  margin: 0.8rem 0;
  padding: 1rem;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.key-list li:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-shadow);
}

.key-name {
  font-weight: bold;
  display: block;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.value-container {
  padding: 0.5rem;
  background-color: #f8f9fa;
  border-radius: 4px;
  overflow: auto;
  max-height: 300px;
  font-family: monospace;
  position: relative;
}

.json-tree {
  font-family: monospace;
  white-space: pre-wrap;
}

.json-tree ul {
  list-style: none;
  margin: 0;
  padding: 0 0 0 1.5rem;
}

.json-tree ul.collapsed {
  display: none;
}

.json-tree ul.expanded {
  display: block;
}

.json-tree .toggle {
  cursor: pointer;
  user-select: none;
  color: var(--primary-color);
}

.json-tree .property {
  color: #854f00;
}

.json-tree .string {
  color: #4f8500;
}

.json-tree .number {
  color: #0044a8;
}

.json-tree .boolean {
  color: #820051;
}

.json-tree .null {
  color: #a80000;
}

.json-tree .editable-field {
  cursor: pointer;
  background-color: transparent;
  transition: background-color 0.2s;
}

.json-tree .editable-field:hover {
  background-color: #e9ecef;
}

.key-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

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

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

.view-btn {
  background-color: var(--info-color);
}

.create-btn {
  margin-top: 1rem;
  background-color: var(--info-color);
  max-width: 200px;
}

.uuid-generator {
  display: flex;
  align-items: center;
  margin: 0.5rem 0;
}

.uuid-generator button {
  background-color: var(--secondary-color);
  font-size: 0.9rem;
}

.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.dialog-content {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  width: 80%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
}

.dialog-tabs {
  display: flex;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 1rem;
}

.dialog-tab {
  padding: 0.5rem 1rem;
  cursor: pointer;
  border: none;
  background-color: transparent;
  color: #495057;
  border-bottom: 2px solid transparent;
}

.dialog-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.dialog-tab-content {
  display: none;
}

.dialog-tab-content.active {
  display: block;
}

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

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

.user-info {
  color: #6c757d;
  font-style: italic;
}

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

.user-badge {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background-color: #6c757d;
  color: white;
}

.admin-badge {
  background-color: var(--danger-color);
}

.newkey-badge {
  background-color: var(--info-color);
}

.user-details {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #dee2e6;
}

.toggle-btn {
  margin-left: auto;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  background-color: #6c757d;
}

.user-keys-list {
  list-style: none;
  padding: 0;
  margin-bottom: 1rem;
}

.user-key-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  border-bottom: 1px solid #eee;
}

.grant-form {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 4px;
}

.grant-form input, .grant-form select {
  width: 70%;
  display: inline-block;
  margin-right: 0.5rem;
}

.grant-btn {
  background-color: var(--secondary-color);
  width: auto;
}

.permission-switch {
  display: flex;
  align-items: center;
  margin: 0.5rem 0;
}

.permission-switch label {
  margin-left: 0.5rem;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--secondary-color);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--secondary-color);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.pagination-controls {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  gap: 0.5rem;
}

.page-btn {
  background-color: #f8f9fa;
  color: #212529;
  border: 1px solid #dee2e6;
  width: auto;
  min-width: 40px;
  height: 40px;
  padding: 0.375rem 0.75rem;
  border-radius: 4px;
}

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

.page-btn:hover:not(.active) {
  background-color: #e9ecef;
  border-color: #dee2e6;
}

.json-explorer-dialog .dialog-content {
  width: 90%;
  max-width: 1000px;
}

.json-path {
  font-family: monospace;
  background-color: #f8f9fa;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  overflow-x: auto;
}

.json-editor-container {
  height: 50vh;
  border: 1px solid #ccc;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .center-box {
    margin: 0;
    height: 100%;
    border-radius: 0;
    max-width: none;
  }
  
  .dialog-content {
    width: 95%;
    padding: 1rem;
  }
  
  .page-btn {
    min-width: 32px;
    height: 32px;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
  }
}
