:root {
  --primary: #5865f2;
  --primary-hover: #4752c4;
  --danger: #ed4245;
  --danger-hover: #c03939;
  --background: #1e1f22;
  --background-secondary: #2b2d31;
  --background-tertiary: #313338;
  --card-bg: #383a40;
  --text-primary: #f2f3f5;
  --text-secondary: #b5bac1;
  --success: #3ba55c;
  --border-radius: 8px;
  --sidebar-width: 240px;
  --transition: all 0.2s ease;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 480px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--background-secondary);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hidden {
  display: none !important;
}

/* Login Form */
#login-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#login-container h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Input Styles */
input, textarea, select {
  width: 100%;
  padding: 12px 16px;
  background: var(--background-tertiary);
  border: 1px solid rgba(0, 0, 0, 0.3);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-size: 1rem;
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.3);
}

/* Button Styles */
button {
  padding: 12px 16px;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

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

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

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

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

.btn-secondary:hover {
  background: #3a3d44;
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.875rem;
}

.btn-icon {
  padding: 8px;
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

/* Layout */
#management-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
}

@media (min-width: 768px) {
  #management-panel {
    flex-direction: row;
  }
}

/* Sidebar */
.sidebar {
  background: var(--background-secondary);
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(0, 0, 0, 0.2);
}

@media (min-width: 768px) {
  .sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
  }
}

@media (max-width: 767px) {
  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  }
}

.tab-btn {
  padding: 12px 16px;
  margin: 0 0.5rem;
  border-radius: var(--border-radius);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: left;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.tab-btn:hover {
  background: rgba(79, 84, 92, 0.4);
  color: var(--text-primary);
}

.tab-btn.active {
  background: rgba(79, 84, 92, 0.6);
  color: var(--text-primary);
}

.tab-btn i {
  font-size: 1.2rem;
}

/* Content Area */
.content {
  flex: 1;
  padding: 1.5rem;
  background: var(--background-tertiary);
}

.tab-content {
  display: none;
}

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

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.card-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.card-body {
  color: var(--text-secondary);
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--background-secondary);
}

/* Status Indicators */
.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-online {
  background: var(--success);
}

.status-offline {
  background: var(--text-secondary);
}

.status-busy {
  background: var(--danger);
}

.status-away {
  background: #faa81a;
}

/* Action Buttons */
.actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--background-secondary);
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-weight: 600;
  font-size: 1.25rem;
}

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

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Form Groups */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* Error Messages */
.error {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--danger);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  animation: slideIn 0.3s ease-out;
  max-width: 320px;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Loading Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Table */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  padding: 0.5rem;
  margin-right: 0.5rem;
}

@media (max-width: 767px) {
  .mobile-menu-toggle {
    display: block;
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
    flex-direction: column;
    padding: 1rem;
  }
  
  .sidebar.open {
    transform: translateX(100%);
  }
  
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    display: none;
  }
  
  .sidebar-overlay.open {
    display: block;
  }
}

/* Top Navigation */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--background-secondary);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Dark/Light Mode Toggle */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 120px;
  background-color: #111;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}
