:root {
  /* Premium Dark Theme Palette */
  --bg: #09090b;
  /* Zinc 950 */
  --card: rgba(24, 24, 27, 0.4);
  /* More transparent for glass effect */
  --card-hover: rgba(39, 39, 42, 0.6);
  --text: #fafafa;
  --subtext: #a1a1aa;

  /* Brand Colors */
  --accent: #3b82f6;
  --accent-viewport: #60a5fa;
  /* Lighter for gradients */
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.15);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Borders & Shadows */
  --border: rgba(255, 255, 255, 0.08);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --glass-highlight: 1px solid rgba(255, 255, 255, 0.12);

  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  --glow: 0 0 20px rgba(59, 130, 246, 0.15);

  --radius: 16px;
  /* slightly rounder */

  /* Typography */
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;

  /* Backgrounds */
  --main-bg: radial-gradient(circle at 50% 0%, #172554 0%, #09090b 50%);
  /* Deeper blue tint at top */
  --sidebar-bg: rgba(9, 9, 11, 0.85);

  /* Charts */
  --chart-text: #a1a1aa;
  --chart-grid: rgba(255, 255, 255, 0.05);

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.light-mode {
  --bg: #f8fafc;
  --card: #ffffff;
  --card-hover: #f1f5f9;
  --text: #0f172a;
  --subtext: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37, 99, 235, 0.1);
  --border: #e2e8f0;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --main-bg: #f8fafc;
  --sidebar-bg: #ffffff;
  --chart-text: #64748b;
  --chart-grid: #e2e8f0;
}

.theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  top: auto;
  z-index: 3000;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25em;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
}

.theme-toggle:hover {
  transform: scale(1.1);
  border-color: var(--accent);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  background-image: var(--main-bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-main);
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Global Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.fade-in-view {
  animation: fadeIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #52525b;
}

.screen {
  display: none;
  height: 100vh;
  overflow: hidden;
}

/* Login */
#loginScreen {
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #1a1a1a 0%, #050505 100%);
}

.login-container {
  background: var(--card);
  padding: 48px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  text-align: center;
  width: 100%;
  max-width: 400px;
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.login-title {
  color: var(--text);
  margin-bottom: 32px;
  font-size: 2em;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.login-title i {
  color: var(--accent);
}

.login-input {
  width: 100%;
  padding: 12px 16px;
  margin: 8px 0;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.95em;
  transition: all 0.2s ease;
}

.login-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  margin-top: 20px;
  font-size: 1em;
  font-weight: 600;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(41, 98, 255, 0.3);
}

.login-error {
  color: var(--danger);
  margin-top: 16px;
  display: none;
  font-size: 0.9em;
}

/* Layout */
#appScreen {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  height: 100vh;
}

#leftPanel,
#rightPanel {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  gap: 24px;
  z-index: 10;
}

#rightPanel {
  border-left: 1px solid var(--border);
  border-right: none;
  display: none;
}

.panel-title,
.panel-subtitle {
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px 0;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.panel-title {
  font-size: 1.1em;
  text-transform: uppercase;
  color: var(--subtext);
  letter-spacing: 1px;
  font-size: 0.8em;
}

.panel-subtitle {
  font-size: 1em;
  color: var(--text);
}

.panel-title i,
.panel-subtitle i {
  color: var(--accent);
}

/* History */
#history {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.history-entry {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  font-size: 0.9em;
  transition: background 0.2s;
}

.history-entry:hover {
  background: var(--hover-bg);
}

.history-entry strong {
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.history-entry small {
  color: var(--subtext);
}

/* Buttons */
.button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.small-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--subtext);
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.small-btn:hover {
  background: var(--card-hover);
  color: var(--text);
  border-color: var(--subtext);
}

.small-btn.danger-btn:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.danger-btn {
  background-color: var(--danger) !important;
  color: white !important;
  border: none !important;
}

.danger-btn:hover {
  background-color: #d50000 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 23, 68, 0.3);
}

.success-btn {
  background-color: var(--success) !important;
  color: #000 !important;
  border: none !important;
}

.success-btn:hover {
  background-color: #00c853 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 230, 118, 0.3);
}

/* Main Area */
#main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: left;
  overflow-y: auto;
  padding: 32px;
  background: var(--main-bg);
}

#dataContainer {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 600px;
  margin-bottom: 32px;
  position: relative;
}

.row-item {
  margin: 16px 0;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.row-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.label {
  color: var(--subtext);
  font-weight: 500;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.value {
  font-size: 1.1em;
  font-weight: 500;
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

/* Controls */
#controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

#controls button {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

#controls button:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(41, 98, 255, 0.2);
}

/* Inputs & Selects */
select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  margin-top: 6px;
  font-family: var(--font-main);
  transition: all 0.2s;
}

select:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* Stats & Filters */
#counterContainer,
#navigationContainer,
.filter-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.counter-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  align-items: center;
}

.counter-label {
  color: var(--subtext);
  font-size: 0.9em;
}

.counter-value {
  font-weight: 700;
  color: var(--text);
  font-feature-settings: "tnum";
}

.checkbox-container {
  display: flex;
  align-items: center;
  margin: 12px 0;
  gap: 10px;
  cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 3px;
}

.checkbox-label {
  color: var(--subtext);
  font-size: 0.9em;
  user-select: none;
}

/* Admin Hub */
.admin-hub {
  padding: 32px;
  overflow-y: auto;
  height: 100vh;
  background: var(--bg);
}

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

.admin-header h1 {
  font-size: 2em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 16px;
  font-weight: 700;
  letter-spacing: -1px;
  margin: 0;
}

/* Data Tables */
.datatable-wrapper .datatable-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.datatable-table {
  width: 100%;
  border-collapse: collapse;
}

.datatable-table th {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--subtext);
  font-weight: 600;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.datatable-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95em;
}

.datatable-pagination {
  padding: 16px 0 0 0;
}

.datatable-pagination a {
  color: var(--subtext);
  padding: 6px 12px;
  margin: 0 4px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.datatable-pagination .datatable-active a,
.datatable-pagination a:hover {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.admin-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 1.2em;
  font-weight: 600;
  margin: 0 0 24px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  align-items: end;
}

.form-label {
  font-size: 0.85em;
  color: var(--subtext);
  margin-bottom: 6px;
  display: block;
  font-weight: 500;
}

.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

/* Notifications */
#notification-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notification {
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  padding: 16px 20px;
  border-left: 4px solid var(--accent);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 320px;
  animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  font-weight: 500;
}

.notification.success {
  border-color: var(--success);
}

.notification.error {
  border-color: var(--danger);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
  backdrop-filter: blur(8px);
}

.modal-content {
  background: var(--card);
  padding: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 500px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
}

/* DataTables Overrides */
.dataTable-wrapper.no-header .dataTable-container {
  border: none;
}

.dataTable-table {
  background: transparent;
  border-collapse: collapse;
  width: 100%;
}

.dataTable-table th {
  background: var(--bg);
  color: var(--subtext);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.dataTable-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95em;
}

.dataTable-table tr:hover td {
  background: var(--hover-bg);
}

.dataTable-input {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 12px;
}

.dataTable-selector {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px;
}

.dataTable-pagination a {
  color: var(--subtext);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  margin: 0 2px;
}

.dataTable-pagination a:hover,
.dataTable-pagination .active a {
  background: var(--accent);
  color: white;
}

/* Responsive */
@media (max-width: 1200px) {
  #appScreen {
    grid-template-columns: 280px 1fr;
  }

  #rightPanel {
    display: none !important;
  }
}

@media (max-width: 768px) {
  #appScreen {
    grid-template-columns: 1fr;
  }

  #leftPanel {
    display: none;
  }

  .admin-hub {
    padding: 16px;
  }

  .login-container {
    padding: 24px;
  }
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-title {
  font-size: 0.9em;
  color: var(--subtext);
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-value {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--text);
}

/* Admin Dashboard Layout */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  overflow: hidden;
  background: transparent;
  /* Allows main body gradient to show */
}

.admin-sidebar {
  background: var(--sidebar-bg);
  border-right: var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sidebar-header {
  padding: 0 12px 24px 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1.25em;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.5px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: var(--subtext);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  font-size: 0.95em;
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nav-item i {
  width: 20px;
  height: 20px;
  color: inherit;
  transition: transform var(--transition-fast);
}

.nav-item:hover {
  background: var(--card-hover);
  color: var(--text);
}

.nav-item:hover i {
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.2);
  font-weight: 600;
}

.admin-content {
  overflow-y: auto;
  padding: 32px;
  position: relative;
}

.dashboard-header {
  margin-bottom: 32px;
  animation: fadeIn 0.5s ease-out;
}

.dashboard-title {
  font-size: 2em;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.dashboard-date {
  color: var(--subtext);
  font-size: 0.95em;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  /* slightly smaller minmax for responsiveness */
  gap: 24px;
  margin-bottom: 32px;
}

.dashboard-card {
  background: var(--card);
  border: var(--glass-border);
  border-top: var(--glass-highlight);
  border-left: var(--glass-highlight);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-fast);
  position: relative;
  /* overflow: hidden; Removed to allow dropdowns to show */
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--glow);
  border-color: rgba(255, 255, 255, 0.15);
}

.dashboard-card::after {
  /* Subtle shine effect */
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.03) 50%, rgba(255, 255, 255, 0) 70%);
  transform: translateY(100%);
  transition: transform 0.6s;
}

.dashboard-card:hover::after {
  transform: translateY(-100%);
}


.user-card {
  background: var(--card);
  border: var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--transition-fast);
}

.user-card:hover {
  transform: scale(1.02);
  background: var(--card-hover);
}

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

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-viewport));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1em;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.user-name {
  font-weight: 600;
  font-size: 1.1em;
  color: var(--text);
}

.user-role {
  font-size: 0.85em;
  color: var(--subtext);
}

/* Spinner Styles */
.loader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(9, 9, 11, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  border-radius: var(--radius);
  animation: fadeIn 0.2s ease-in;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s ease-in-out infinite;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  .admin-layout {
    grid-template-columns: 200px 1fr;
  }

  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .stat-value {
    font-size: 1.5em;
  }
}

@media (max-width: 768px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    display: none;
    /* In a real app we'd adhere to a hamburger menu, for now simpler */
  }

  .admin-content {
    padding: 16px;
    /* Reduced padding on mobile */
  }

  .dashboard-title {
    font-size: 1.5em;
    /* Smaller title on mobile */
  }
}

/* Custom Dropdown */
.custom-dropdown {
  position: relative;
  width: 100%;
}

#disposition-dropdown-btn {
  cursor: pointer;
  height: auto;
  min-height: 42px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-main);
  font-size: 14px;
  width: 100%;
  margin-top: 6px;
}

#disposition-dropdown-btn:hover {
  border-color: var(--subtext);
}

#disposition-dropdown-btn:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  padding: 8px;
}

.dropdown-content.show {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: var(--hover-bg);
}

.dropdown-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.dropdown-item label {
  cursor: pointer;
  flex: 1;
  font-size: 0.9em;
  color: var(--text);
}

/* ==========================================
   RINGCENTRAL ACTIVITY TABLE STYLES
   ========================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: transparent;
}

.data-table thead {
  background: var(--card);
  border-bottom: 2px solid var(--border);
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--subtext);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.95em;
}

.data-table tbody tr {
  transition: background 0.2s ease;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table .time {
  font-weight: 700;
  color: var(--accent);
  font-feature-settings: "tnum";
}

.data-table .muted {
  text-align: center;
  color: var(--subtext);
  padding: 32px;
  font-style: italic;
}

/* Responsive table wrapper */
.data-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================
   FLOATING DIALER WIDGET
   ========================================== */
.floating-dialer {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 1500;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-dialer.pinned {
  bottom: auto;
  top: 12px;
  right: 24px;
}

/* FAB Button (visible when minimized) */
.dialer-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white;
  box-shadow: 0 4px 24px rgba(59, 130, 246, 0.4), 0 0 0 0 rgba(59, 130, 246, 0.3);
  transition: all 0.3s ease;
  animation: dialerPulse 2.5s ease-in-out infinite;
}

.dialer-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(59, 130, 246, 0.5);
}

.dialer-fab i {
  width: 24px;
  height: 24px;
}

@keyframes dialerPulse {

  0%,
  100% {
    box-shadow: 0 4px 24px rgba(59, 130, 246, 0.4), 0 0 0 0 rgba(59, 130, 246, 0.3);
  }

  50% {
    box-shadow: 0 4px 24px rgba(59, 130, 246, 0.4), 0 0 0 10px rgba(59, 130, 246, 0);
  }
}

/* When minimized: show FAB, hide panel */
.floating-dialer.minimized .dialer-panel {
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  pointer-events: none;
  position: absolute;
  bottom: 70px;
  right: 0;
}

.floating-dialer.minimized .dialer-fab {
  display: flex;
}

/* When expanded: hide FAB, show panel */
.floating-dialer:not(.minimized) .dialer-fab {
  display: none;
}

.floating-dialer:not(.minimized) .dialer-panel {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* Dialer Panel */
.dialer-panel {
  width: 340px;
  background: rgba(24, 24, 32, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.dialer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dialer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95em;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.dialer-title i {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.dialer-controls {
  display: flex;
  gap: 4px;
}

.dialer-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--subtext);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.dialer-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.dialer-icon-btn.active {
  color: var(--accent);
  background: var(--accent-light);
}

.dialer-icon-btn i {
  width: 16px;
  height: 16px;
}

.dialer-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialer-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dialer-label {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--subtext);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dialer-input-row {
  display: flex;
  gap: 8px;
}

.dialer-input-row .form-input {
  flex: 1;
}

.dialer-call-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.dialer-call-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

.dialer-call-btn i {
  width: 20px;
  height: 20px;
}

.dialer-save-btn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9em;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.dialer-save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.dialer-save-btn i {
  width: 16px;
  height: 16px;
}

/* Undo Last Disposition Button */
.dialer-undo-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.85em;
  transition: all 0.2s ease;
  margin-top: 2px;
}

.dialer-undo-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.6);
  transform: translateY(-1px);
}

.dialer-undo-btn i {
  width: 16px;
  height: 16px;
}

/* Toggle button in controls bar */
.dialer-toggle-btn {
  background: linear-gradient(135deg, var(--accent), #6366f1) !important;
  color: white !important;
  border: none !important;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
  transition: all 0.2s ease !important;
}

.dialer-toggle-btn:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5) !important;
}