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

:root {
  /* VWA Light Theme - Volvo Blue */
  --primary: #1c6bba;
  --primary-dark: #155a9e;
  --primary-light: #3d8fd4;
  --bg-page: #f5f5f5;
  --bg-white: #ffffff;
  --bg-gray-50: #f9fafb;
  --bg-gray-100: #f5f5f5;
  --bg-gray-200: #e5e5e5;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #8a8a8a;
  --border-color: #e5e5e5;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);

  /* Message colors */
  --incoming-bg: #ffffff;
  --outgoing-bg: #1c6bba;
  --outgoing-text: #ffffff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}

.screen {
  height: 100vh;
}

.hidden {
  display: none !important;
}

/* ==================== LOGIN SCREEN ==================== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-gray-100);
}

.login-box {
  background: var(--bg-white);
  padding: 48px 40px;
  border-radius: 12px;
  text-align: center;
  min-width: 420px;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-box .logo {
  margin-bottom: 24px;
}

.login-box .logo img {
  height: 48px;
}

.login-box h1 {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 28px;
  font-weight: 600;
}

.login-box .subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 14px;
}

.login-box .form-group {
  text-align: left;
  margin-bottom: 20px;
}

.login-box label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.login-box input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 107, 186, 0.1);
}

.login-box input::placeholder {
  color: var(--text-muted);
}

.login-box button[type="submit"] {
  width: 100%;
  padding: 14px;
  background: #25D366;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-box button[type="submit"]:hover {
  background: #128C7E;
}

.login-box button[type="submit"]:active {
  transform: scale(0.98);
}

.login-box .security-note {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.login-box .security-note .shield {
  font-size: 14px;
}

.error {
  color: #ef4444;
  margin-top: 12px;
  font-size: 14px;
}

.success {
  color: #10b981;
  margin-top: 12px;
  font-size: 14px;
}

/* ==================== APP LAYOUT ==================== */
#app-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ==================== ICON SIDEBAR ==================== */
.icon-sidebar {
  width: 64px;
  background: #f0f2f5;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 0;
}

.icon-sidebar-top,
.icon-sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sidebar-icon {
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
  position: relative;
}

.sidebar-icon:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.sidebar-icon.active {
  background: rgba(37, 211, 102, 0.1);
  color: #25D366;
}

.sidebar-icon svg {
  width: 26px;
  height: 26px;
}

.sidebar-icon-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #25D366;
  color: white;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-icon-badge.hidden {
  display: none;
}

/* Sidebar Logo */
.sidebar-logo {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 8px;
}

/* ==================== SIDEBAR HEADER ==================== */
.sidebar-header {
  padding: 0;
  border-bottom: none;
}

.sidebar-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px 12px 16px;
}

.sidebar-header-top h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.sidebar-header-top .user-name {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Channel Tabs - Inside Sidebar */
.channel-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-gray-100);
  padding: 4px;
  border-radius: 8px;
  margin: 0 16px 12px 16px;
}

.channel-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.channel-tab:hover {
  color: var(--text-primary);
}

.channel-tab.active {
  background: var(--bg-white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Channel Tab Icons and Badges */
.channel-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.channel-tab .whatsapp-icon {
  flex-shrink: 0;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #25D366;
  color: white;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 2px;
}

.channel-badge.hidden {
  display: none;
}

/* Header User & Logout */
.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user .user-name {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.logout-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}

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

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: 350px;
  background: var(--bg-white);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

/* Search Box */
.search-box {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.search-box input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-gray-50);
  font-size: 14px;
  color: var(--text-primary);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.search-box input::placeholder {
  color: var(--text-muted);
}

/* Filter Tabs - WhatsApp style */
.filter-tabs {
  display: flex;
  padding: 8px 12px;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

.filter-tab {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-white);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover {
  background: var(--bg-gray-50);
}

.filter-tab.active {
  background: #e7f3e9;
  border-color: #25D366;
  color: #128C7E;
}

/* Legacy filters - hidden */
.filters {
  display: none;
}

.filter-btn {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-gray-100);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: var(--bg-gray-200);
  color: var(--text-primary);
}

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

/* Conversation List */
.conversation-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}

.conversation-item:hover {
  background: var(--bg-gray-50);
}

.conversation-item.active {
  background: rgba(28, 107, 186, 0.08);
  border-left: 3px solid var(--primary);
}

.conversation-item .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  font-size: 16px;
  flex-shrink: 0;
}

.conversation-item .conversation-content {
  flex: 1;
  min-width: 0;
}

.conversation-item .conversation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.conversation-item .name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.conversation-item .time {
  font-size: 12px;
  color: var(--text-muted);
}

.conversation-item .conversation-preview {
  display: flex;
  align-items: center;
  gap: 8px;
}

.conversation-item .preview-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-item .preview-icon {
  font-size: 14px;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.status-badge.open {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.in_progress {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.closed {
  background: #d1fae5;
  color: #065f46;
}

/* Unread badge */
.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #25D366;
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.conversation-item.has-unread .name {
  font-weight: 700;
}

.conversation-item.has-unread .preview-text {
  color: var(--text-primary);
  font-weight: 500;
}

/* ==================== CHAT AREA ==================== */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-gray-100);
}

.no-conversation {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.no-conversation .icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 16px 20px;
  background: var(--bg-white);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.contact-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-info .contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  font-size: 14px;
}

.contact-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.contact-info span {
  font-size: 13px;
  color: var(--text-secondary);
}

.chat-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-actions select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.chat-actions select:focus {
  outline: none;
  border-color: var(--primary);
}

#select-mode-btn {
  padding: 8px 16px;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

#select-mode-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

/* ==================== SELECTION TOOLBAR ==================== */
.selection-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.selection-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.selection-info .select-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.selection-info .select-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

#selection-count {
  font-size: 14px;
  font-weight: 500;
}

.selection-actions {
  display: flex;
  gap: 12px;
}

.selection-actions .action-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

.selection-actions .action-btn.primary:hover:not(:disabled) {
  background: var(--bg-gray-100);
}

.selection-actions .action-btn.primary:disabled {
  background: rgba(255, 255, 255, 0.5);
  color: rgba(28, 107, 186, 0.5);
  cursor: not-allowed;
}

.selection-actions .action-btn:not(.primary) {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.selection-actions .action-btn:not(.primary):hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ==================== MESSAGE SELECTION ==================== */
.message.selectable {
  cursor: pointer;
  position: relative;
  padding-left: 44px;
}

.message.selectable::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background: white;
  transition: all 0.2s;
}

.message.selectable.selected::before {
  background: var(--primary);
  border-color: var(--primary);
}

.message.selectable.selected::after {
  content: '✓';
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.message.selectable:hover:not(.selected)::before {
  border-color: var(--primary-light);
}

.message.incoming.selectable {
  padding-left: 44px;
}

.message.outgoing.selectable {
  padding-right: 44px;
  padding-left: 16px;
}

.message.outgoing.selectable::before {
  left: auto;
  right: 12px;
}

.message.outgoing.selectable::after {
  left: auto;
  right: 15px;
}

.message.outgoing.selectable::before {
  border-color: rgba(255, 255, 255, 0.5);
  background: transparent;
}

.message.outgoing.selectable.selected::before {
  background: white;
  border-color: white;
}

.message.outgoing.selectable.selected::after {
  color: var(--primary);
}

/* ==================== MESSAGES ==================== */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 65%;
  padding: 12px 16px;
  border-radius: 16px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.message.incoming {
  background: var(--bg-white);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}

.message.outgoing {
  background: var(--primary);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  color: white;
}

.message .content {
  word-wrap: break-word;
  line-height: 1.5;
}

.message .meta {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.7;
}

.message.incoming .meta {
  color: var(--text-secondary);
}

.message .sender {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.9;
}

/* ==================== MESSAGE INPUT ==================== */
.message-input {
  padding: 16px 20px;
  background: var(--bg-white);
  display: flex;
  gap: 12px;
  align-items: flex-end;
  border-top: 1px solid var(--border-color);
}

.message-input textarea {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  background: var(--bg-gray-50);
  color: var(--text-primary);
  font-size: 14px;
  resize: none;
  max-height: 120px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.message-input textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.message-input textarea::placeholder {
  color: var(--text-muted);
}

#send-btn {
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s, transform 0.1s;
}

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

#send-btn:active {
  transform: scale(0.95);
}

#send-btn:disabled {
  background: var(--bg-gray-200);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-gray-200);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==================== MEDIA CONTENT ==================== */
.media-content {
  margin-bottom: 4px;
  position: relative;
}

.media-content img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.media-content img:hover {
  opacity: 0.9;
}

.media-content .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  pointer-events: none;
}

.media-content .video-thumbnail {
  filter: brightness(0.85);
}

.media-content video {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
}

.media-content audio {
  width: 100%;
  min-width: 200px;
}

.media-content.document a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-gray-100);
  border-radius: 12px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.2s;
}

.message.outgoing .media-content.document a {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.media-content.document a:hover {
  background: var(--bg-gray-200);
}

/* ==================== MEDIA VIEWER MODAL ==================== */
.media-viewer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.media-viewer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
}

.media-viewer-content {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 1;
}

.media-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.5);
}

.media-viewer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.media-viewer-info span:first-child {
  font-weight: 500;
  color: white;
}

.media-viewer-info span:last-child {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.media-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.media-viewer-actions button {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: white;
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-viewer-actions button:hover {
  background: rgba(255, 255, 255, 0.1);
}

#media-zoom-level {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  min-width: 50px;
  text-align: center;
}

.media-viewer-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.media-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 32px;
  cursor: pointer;
  border-radius: 50%;
  z-index: 10;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-nav-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.media-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

#media-prev {
  left: 20px;
}

#media-next {
  right: 20px;
}

.media-viewer-container {
  max-width: calc(100% - 140px);
  max-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.media-viewer-container:active {
  cursor: grabbing;
}

.media-viewer-container img,
.media-viewer-container video {
  max-width: 100%;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  transition: transform 0.1s ease-out;
}

.media-viewer-footer {
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.media-thumbnails {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
}

.media-thumbnails img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.media-thumbnails img:hover {
  opacity: 0.8;
}

.media-thumbnails img.active {
  opacity: 1;
  border-color: var(--primary);
}

#media-counter {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

/* ==================== USER MANAGEMENT ==================== */
.admin-panel {
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.admin-panel h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.user-table {
  width: 100%;
  background: var(--bg-white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.user-table th,
.user-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.user-table th {
  background: var(--bg-gray-50);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
  text-transform: uppercase;
}

.user-table td {
  font-size: 14px;
  color: var(--text-primary);
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

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

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

.btn-danger:hover {
  background: #fecaca;
}

/* ==================== MODAL ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-content.modal-small {
  max-width: 400px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-gray-100);
  color: var(--text-primary);
}

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

/* ==================== USER MANAGEMENT ==================== */
.user-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.user-list-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--bg-gray-50);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.user-item.inactive {
  opacity: 0.5;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-details .name {
  font-weight: 500;
  color: var(--text-primary);
}

.user-details .email {
  font-size: 13px;
  color: var(--text-muted);
}

.user-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-left: 8px;
}

.user-badge.admin {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.user-badge.inactive {
  background: #fee2e2;
  color: #dc2626;
}

.user-actions {
  display: flex;
  gap: 8px;
}

.user-actions button {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  background: white;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-actions button:hover {
  background: var(--bg-gray-100);
}

.user-actions button.delete:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
}

/* ==================== FORM STYLES ==================== */
.form-group {
  margin-bottom: 16px;
}

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

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-primary);
  background: white;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 107, 186, 0.1);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* ==================== SETTINGS MODAL ==================== */
.settings-channel-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-gray-100);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.settings-channel-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.settings-channel-tab:hover {
  color: var(--text-primary);
}

.settings-channel-tab.active {
  background: var(--bg-white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.settings-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.settings-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Toggle Switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: normal !important;
}

.toggle-label input {
  display: none;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--bg-gray-200);
  border-radius: 12px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-label input:checked + .toggle-switch {
  background: #25D366;
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(20px);
}

/* Textarea in settings */
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  resize: vertical;
  min-height: 100px;
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28, 107, 186, 0.1);
}

.form-group textarea::placeholder {
  color: var(--text-muted);
}
