/* General Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #334155;
  background-color: #f8fafc;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Layout Container */
.admin-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Left Sidebar Navigation */
.sidebar {
  width: 240px;
  background-color: #0f172a;
  color: #e2e8f0;
  display: flex;
  flex-direction: flex-direction;
  flex-direction: column;
  justify-content: space-between;
  border-r: 1px solid #1e293b;
  flex-shrink: 0;
}

.logo-section {
  padding: 24px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #1e293b;
}

.logo-box {
  width: 28px;
  height: 28px;
  background-color: #3b82f6;
  border-radius: 6px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.nav-menu {
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.nav-item {
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  border-radius: 6px;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  outline: none;
}

.nav-item:hover {
  background-color: #1e293b;
  color: #ffffff;
}

.nav-item.active {
  background-color: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #1e293b;
  background-color: #0b0f19;
}

.version-text {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Main Workspace Panel */
.workspace {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-header {
  height: 64px;
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.workspace-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.connection-status {
  font-size: 12px;
  font-weight: 600;
  color: #16a34a;
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 4px 10px;
  border-radius: 20px;
}

.view-container {
  padding: 24px;
  flex-grow: 1;
  overflow-y: auto;
}

/* Tab Switching Layout */
.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

/* Toolbar Buttons & Forms */
.toolbar {
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
}

.btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary {
  background-color: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-secondary {
  background-color: #ffffff;
  color: #475569;
  border-color: #cbd5e1;
}

.btn-secondary:hover {
  background-color: #f8fafc;
  color: #0f172a;
}

.btn-danger {
  background-color: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
}

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

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
}

/* Data Tables styling */
.table-wrapper {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

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

.data-table th {
  background-color: #f8fafc;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

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

.data-table tr:hover td {
  background-color: #f8fafc;
}

/* Badges & Indicators */
.badge {
  display: inline-flex;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  text-transform: uppercase;
}

.badge-success {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-danger {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-warning {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-info {
  background-color: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-neutral {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* Sub Navigation & Selector Bars */
.tab-sub-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

.sub-nav-item {
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  outline: none;
  border-radius: 4px;
}

.sub-nav-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.sub-nav-item.active {
  background-color: #e2e8f0;
  color: #0f172a;
}

.selector-bar {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.selector-bar label {
  font-weight: 600;
  color: #475569;
}

.selector-bar select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  outline: none;
  min-width: 240px;
  background-color: #ffffff;
}

/* Details Panel Grid Cards */
.details-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.details-card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
}

.details-card h3 {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Input Fields and Labels */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  outline: none;
  color: #0f172a;
  background-color: #ffffff;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

.form-group input[readonly] {
  background-color: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

.toggle-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.required {
  color: #ef4444;
}

.empty-state {
  background-color: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 48px 24px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}

/* Modals layout popup */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background-color: #ffffff;
  border-radius: 8px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-content.modal-lg {
  max-width: 720px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #f8fafc;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #94a3b8;
  cursor: pointer;
}

.modal-close:hover {
  color: #334155;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: #f8fafc;
}

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.form-group.span-2 {
  grid-column: span 2;
}

/* Detail Modal Tab styles */
.details-tab-nav {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 16px;
}

.details-tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.details-tab-btn:hover {
  color: #0f172a;
}

.details-tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

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

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

.profile-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.p-field {
  font-size: 13px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

.p-field strong {
  color: #64748b;
  text-transform: uppercase;
  font-size: 11px;
  display: block;
  margin-bottom: 2px;
  letter-spacing: 0.5px;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.pt-4 { padding-top: 16px; }
.pb-2 { padding-bottom: 8px; }
.action-buttons {
  display: flex;
  gap: 8px;
}
.action-link {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.action-link:hover {
  text-decoration: underline;
}
.action-link.danger {
  color: #ef4444;
}

/* Login Screen Overlay Layout */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  background-color: #0f172a;
}

.login-card {
  background-color: #ffffff;
  border-radius: 12px;
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border: 1px solid #e2e8f0;
}

.login-logo-section {
  text-align: center;
  margin-bottom: 24px;
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
  font-weight: 500;
  line-height: 1.4;
}

.login-error-msg {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

/* Custom Animated Modal Keyframes */
@keyframes adminFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes adminScaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal.animate-fade-in {
  animation: adminFadeIn 0.2s ease-out forwards;
}

.modal-content.animate-scale-up {
  animation: adminScaleUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
