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

:root {
  /* Light mode colors */
  --primary-color: #0066cc;
  --primary-dark: #0052a3;
  --background-color: #ffffff;
  --sidebar-bg: #f5f5f5;
  --sidebar-text: #2c2d30;
  --sidebar-border: #e0e0e0;
  --text-primary: #2c2d30;
  --text-secondary: #717274;
  --border-color: #ccc;
  --input-bg: #ffffff;
  --input-border: #ccc;
  --error-bg: #f8d7da;
  --error-text: #721c24;
  --error-border: #f5c6cb;
  --success-bg: #d4edda;
  --success-text: #155724;
  --success-border: #c3e6cb;
  --loading-bg: #d1ecf1;
  --loading-text: #0c5460;
  --loading-border: #bee5eb;
  --permission-error-bg: #f8d7da;
  --permission-error-text: #721c24;
  --logout-bg: rgba(255, 59, 48, 0.1);
  --logout-text: #ff3b30;
  --logout-border: rgba(255, 59, 48, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #1a1a1a;
    --sidebar-bg: #0d0d0d;
    --sidebar-text: #e0e0e0;
    --sidebar-border: #333333;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --border-color: #444444;
    --input-bg: #2a2a2a;
    --input-border: #444444;
    --error-bg: #5a2c2c;
    --error-text: #ffcccc;
    --error-border: #8b4242;
    --success-bg: #2c5a2c;
    --success-text: #ccffcc;
    --success-border: #428b42;
    --loading-bg: #2c4a5a;
    --loading-text: #ccffff;
    --loading-border: #428b8b;
    --permission-error-bg: #5a2c2c;
    --permission-error-text: #ffcccc;
    --logout-bg: rgba(255, 59, 48, 0.2);
    --logout-text: #ff6b63;
    --logout-border: rgba(255, 59, 48, 0.4);
  }
}

html {
  color-scheme: light dark;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: var(--background-color);
  color: var(--text-primary);
  min-height: 100vh;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

#app {
  width: 100%;
  min-height: 100vh;
}

.screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  animation: fadeIn 0.3s ease-in;
}

.screen.hidden {
  display: none;
}

/* Auth Loading Overlay */
.auth-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.auth-loading.hidden {
  display: none;
}

.auth-loading-card {
  background: var(--background-color);
  border: 1px solid var(--sidebar-border);
  border-radius: 16px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  min-width: 280px;
}

.auth-loading-card p {
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 16px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(0, 102, 204, 0.2);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Login Screen */
.login-container {
  background: var(--background-color);
  border-radius: 12px;
  padding: 60px 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  text-align: center;
  max-width: 400px;
  width: 90%;
  border: 1px solid var(--sidebar-border);
}

.logo-section {
  margin-bottom: 40px;
}

.logo-section h1 {
  font-size: 32px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.logo-section h1 i {
  color: var(--primary-color);
  margin-right: 8px;
}

.logo-section p {
  color: var(--text-secondary);
  font-size: 16px;
}

.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.login-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 102, 204, 0.3);
}

.login-error {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
  font-size: 14px;
  text-align: left;
}

.login-error.hidden {
  display: none;
}

/* Main Container */
.main-container {
  display: flex;
  width: 100%;
  height: 100vh;
  background: var(--background-color);
  position: relative;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1001;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.mobile-menu-btn:active {
  transform: scale(0.95);
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    transform 0.3s ease;
  position: relative;
}

/* Close Sidebar Button (Mobile) */
.close-sidebar-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  font-size: 24px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  transition: all 0.2s ease;
  z-index: 10;
}

.close-sidebar-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.close-sidebar-btn:active {
  transform: scale(0.9);
}

.sidebar-header {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--sidebar-border);
  padding-bottom: 16px;
}

.sidebar-header h1 {
  font-size: 18px;
  margin-bottom: 8px;
  font-weight: 700;
}

.sidebar-header h1 i {
  color: var(--primary-color);
  margin-right: 8px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-image {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-color);
  background: var(--input-bg);
}

.profile-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-name {
  font-weight: 600;
  color: var(--text-primary);
}

.profile-email,
.profile-userid {
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-all;
}

.user-info {
  font-size: 12px;
  opacity: 0.7;
}

.modules-nav {
  flex: 1;
  margin-bottom: auto;
}

.nav-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-weight: 600;
  opacity: 0.7;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  margin-bottom: 8px;
}

.nav-item:hover {
  background: rgba(0, 102, 204, 0.1);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(0, 102, 204, 0.15);
  color: var(--primary-color);
  font-weight: 600;
}

.nav-item i {
  width: 20px;
  text-align: center;
}

.logout-btn {
  padding: 12px;
  background: var(--logout-bg);
  color: var(--logout-text);
  border: 1px solid var(--logout-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background: rgba(255, 59, 48, 0.2);
  border-color: rgba(255, 59, 48, 0.4);
}

/* Content Area */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  background: var(--background-color);
}

.module {
  display: none;
  animation: slideIn 0.3s ease;
}

.module.active {
  display: block;
}

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

.module-header {
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.module-header h2 {
  font-size: 28px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.module-header h2 i {
  color: var(--primary-color);
  margin-right: 8px;
}

.module-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.announcements-list {
  max-width: 900px;
  margin-bottom: 32px;
  padding: 20px;
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  background: var(--sidebar-bg);
}

.announcements-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.announcements-header h3 {
  font-size: 16px;
  color: var(--text-primary);
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--sidebar-border);
  background: var(--background-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.announcements-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.announcement-card {
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  padding: 16px;
  background: var(--background-color);
}

.announcement-card h4 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.announcement-card p {
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.announcement-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
  align-items: center;
}

.announcement-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.announcements-empty {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 12px 0;
}

/* Forms */
.form-section {
  max-width: 600px;
}

.channel-hint {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px 0;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.secondary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  background: var(--background-color);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  border: 1px solid var(--sidebar-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h3 {
  font-size: 18px;
  color: var(--text-primary);
}

.modal-body {
  padding: 16px 24px 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px 24px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--input-bg);
  color: var(--text-primary);
  transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-group textarea {
  resize: vertical;
}

.send-btn {
  width: 100%;
  padding: 14px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.send-btn:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 102, 204, 0.3);
}

.send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Status Messages */
.status-message {
  margin-top: 20px;
  padding: 16px;
  border-radius: 6px;
  font-size: 14px;
  display: none;
  animation: slideIn 0.3s ease;
}

.status-message.show {
  display: block;
}

.status-message.success {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.status-message.error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.status-message.loading {
  background: var(--loading-bg);
  color: var(--loading-text);
  border: 1px solid var(--loading-border);
}

/* Permission Error */
.permission-error {
  padding: 20px;
  background: var(--permission-error-bg);
  color: var(--permission-error-text);
  border: 1px solid var(--error-border);
  border-radius: 6px;
  margin-bottom: 24px;
}

.permission-error.hidden {
  display: none;
}

/* Settings */
.settings-content {
  max-width: 600px;
}

.setting-item {
  background: var(--sidebar-bg);
  padding: 20px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid var(--sidebar-border);
}

.setting-item h3 {
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 16px;
}

.setting-item p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Help */
.help-content {
  max-width: 600px;
}

.help-content h3 {
  color: var(--text-primary);
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 16px;
}

.help-content p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.help-content ul {
  list-style: none;
  padding: 0;
}

.help-content ul li {
  color: var(--text-secondary);
  padding: 8px 0;
  line-height: 1.6;
}

.help-content ul li i {
  color: var(--primary-color);
  margin-right: 8px;
  width: 20px;
}

/* Responsive */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
    height: auto;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 16px;
  }

  .sidebar-header {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    margin-right: 24px;
  }

  .modules-nav {
    display: flex;
    gap: 16px;
    margin-bottom: 0;
  }

  .nav-section {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .nav-section h3 {
    display: none;
  }

  .nav-item {
    margin-bottom: 0;
  }

  .logout-btn {
    margin-left: auto;
  }

  .content {
    padding: 24px;
  }

  .module-header h2 {
    font-size: 24px;
  }
}
