:root {
  --primary: #1c2331;
  --primary-light: #28314a;
  --accent: #229ed9;
  --accent-gradient: linear-gradient(90deg, #229ed9 0%, #62d1ff 100%);
  --success: #2ecc71;
  --danger: #e74c3c;
  --surface: #fff;
  --surface-alt: #f5f8fb;
  --border: #e7eaf0;
  --shadow: 0 2px 24px 0 rgba(44,56,104,0.09);
  --radius: 14px;
  --font: 'Inter', 'Segoe UI', Arial, sans-serif;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--surface-alt);
  color: #222b45;
  min-height: 100vh;
  letter-spacing: 0.01em;
}
#app-root { min-height: 100vh; }

/* SIDEBAR */
.admin-sidebar {
  background: #000;
  color: #fff;
  width: 234px;
  min-width: 200px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  z-index: 1200;
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(.42,0,.58,1), box-shadow 0.18s;
  box-shadow: 2px 0 30px -8px #1c233130;
  will-change: transform;
}
.admin-sidebar.closed {
  transform: translateX(-120%);
  box-shadow: none;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 28px 18px 28px;
  font-size: 1.35em;
  font-weight: 800;
  background: linear-gradient(120deg, #232d46 0%, #2aa6f7 100%);
  border-bottom: 1px solid #2c3553;
}
.sidebar-header img {
  height: 28px;
}
.sidebar-nav {
  flex: 1;
  padding-top: 12px;
}
.sidebar-nav ul {
  list-style: none;
  padding: 0 0 24px 0;
  margin: 0;
}
.sidebar-nav li {
  margin-bottom: 3px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 15px;
  color: #e1e8f5;
  text-decoration: none;
  font-size: 1.07em;
  padding: 11px 28px 11px 36px;
  border-left: 4px solid transparent;
  border-radius: 0 24px 24px 0;
  transition: background 0.16s, color 0.16s, border-left 0.16s;
  font-weight: 600;
  position: relative;
  z-index: 1;
}
.sidebar-nav a.active, .sidebar-nav a:hover {
  background: #28315b;
  color: #fff;
  border-left: 4px solid var(--accent);
}
.sidebar-footer {
  margin-bottom: 26px;
  margin-top: auto;
  text-align: center;
  opacity: 0.7;
  font-size: 0.93em;
}
.sidebar-toggle {
  position: fixed;
  top: 21px;
  right: 36px;
  z-index: 1220;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 7px;
  width: 40px;
  height: 40px;
  box-shadow: 0 2px 10px #232d463a;
  font-size: 1.4em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-toggle {
  background: linear-gradient(120deg, #232d46 0%, #2aa6f7 100%) !important;
}
.sidebar-toggle:hover {
  background: linear-gradient(120deg, #1a2333 0%, #1c8fd9 100%) !important;
}

@media (max-width: 950px) {
  .admin-sidebar {
      position: fixed;
      z-index: 1200;
      height: 100vh;
      transform: translateX(-120%);
      box-shadow: none;
  }
  .admin-sidebar:not(.closed) {
      transform: translateX(0);
      box-shadow: 2px 0 30px -8px #1c233130;
  }
  .sidebar-toggle { display: flex; }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open #sidebarOverlay { display: block !important; }
}

/* SIDEBAR OVERLAY (for mobile) */
#sidebarOverlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(36,41,57,0.17);
  z-index: 1199;
}

/* MAIN PANEL */
.main-panel {
  margin-left: 234px;
  min-height: 100vh;
  background: transparent;
  transition: margin 0.28s;
}
@media (max-width: 950px) {
  .main-panel {
      margin-left: 0;
  }
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  box-shadow: 0 2px 10px 0 #232d460c;
  padding: 21px 36px 18px 36px;
  position: sticky;
  top: 0;
  z-index: 101;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 1.35em;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 1px;
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 1.1em;
  box-shadow: 0 2px 8px #229ed93c;
}

/* CARD & CONTENT */
.container-panel {
  max-width: 1200px;
  margin: 40px auto 0 auto;
  padding: 0 24px 40px 24px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 42px;
  padding: 36px 40px 32px 40px;
  border: none;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 10px;
}
.section-header h2 {
  margin: 0;
  color: var(--primary);
  font-size: 1.22em;
  font-weight: 800;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.sessions-table-scroll {
  max-height: 400px;
  min-height: 260px;
  overflow-y: auto;
  border-radius: var(--radius);
  box-shadow: 0 1px 8px #26386818 inset;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #e6e9f0;
}
.sessions-table-scroll::-webkit-scrollbar {
  width: 10px;
  background: #e6e9f0;
  border-radius: 8px;
}
.sessions-table-scroll::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 8px;
}
.sessions-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #168abe;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td {
  padding: 13px 11px;
  border-bottom: 1.5px solid var(--border);
  text-align: center;
  font-size: 1em;
  vertical-align: middle;
}
th {
  background: var(--surface-alt);
  font-weight: 700;
  color: var(--primary);
  position: sticky;
  top: 0;
  z-index: 2;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.13s; }
tbody tr:hover { background: #f4f8ff; }
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  border-radius: 7px;
  padding: 4px 12px;
  font-size: 0.97em;
}
.badge-status.valid { color: #fff; background: var(--success);}
.badge-status.invalid { color: #fff; background: var(--danger);}
.badge-status.unknown { background: #e4e8ef; color: #888; }

/* Avatar and Session Icon */
.sess-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--primary);
  font-size: 1.1em;
  margin-right: 8px;
  border: 2px solid var(--border);
  justify-content: center;
}
.sess-avatar i { font-size: 1.2em; }

/* TOAST & LOADING */
#toast {
  position: fixed;
  bottom: 30px;
  right: 38px;
  background: #232d46;
  color: #fff;
  border-radius: 11px;
  padding: 15px 34px;
  box-shadow: 0 2px 24px #232d468c;
  font-size: 1.08em;
  z-index: 1400;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}
#toast.show {
  display: block;
  opacity: 1;
}
#loading {
  display: none;
  position: fixed;
  left: 0; top: 0;
  width: 100vw; height: 100vh;
  background: #232d4630;
  justify-content: center; align-items: center;
  z-index: 1300;
  font-size: 2.2em;
  color: var(--primary);
}

/* SESSIONS PAGE CUSTOMIZATIONS */
#refreshSessionsBtn {
  background: linear-gradient(120deg, #232d46 0%, #2aa6f7 100%) !important;
  color: #fff !important;
  border: none !important;
}
#refreshSessionsBtn:hover {
  background: linear-gradient(120deg, #1a2333 0%, #1f8cd4 100%) !important;
  transform: translateY(-1px);
}
.delete-session-btn,
.btn-danger.delete-session-btn {
  background: #8B0000 !important;
  border: none !important;
  color: #fff !important;
}
.delete-session-btn:hover,
.btn-danger.delete-session-btn:hover {
  background: #6B0000 !important;
  transform: translateY(-1px);
}
.sess-status-valid {
  color: #32CD32;
  font-weight: 600;
}
.sess-status-valid i {
  color: #32CD32;
}
.sess-status-invalid {
  color: #8B0000;
  font-weight: 600;
}
.sess-status-invalid i {
  color: #8B0000;
}

/* COMPOSE PAGE CHECKBOXES */
.session-checkbox,
#selectAllSessions {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #32CD32;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  margin-right: 8px !important;
  flex-shrink: 0;
}
.session-checkbox:checked,
#selectAllSessions:checked {
  background: #32CD32;
  border-color: #32CD32;
}
.session-checkbox:checked::after,
#selectAllSessions:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
}
#composeFormDiv label {
  display: flex;
  align-items: center;
  cursor: pointer;
}
#composeFormDiv > div > div:nth-child(2) > div {
  background: linear-gradient(120deg, #232d46 0%, #2aa6f7 100%) !important;
}

/* LOGIN */
.login-bg {
  background: linear-gradient(120deg, #232d46 0%, #2aa6f7 100%);
  min-height: 100vh;
}
.login-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 40px 34px 40px;
  max-width: 370px;
  width: 100%;
  text-align: center;
  animation: fadein 0.7s;
}
@keyframes fadein {
  from { opacity: 0; transform: translateY(-30px);}
  to { opacity: 1; transform: none;}
}
.login-brand {
  font-size: 1.6em;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  margin-bottom: 18px;
  color: var(--primary);
  letter-spacing: 1px;
}
.login-card h2 {
  font-weight: 800;
  margin-bottom: 18px;
  color: var(--primary);
  letter-spacing: 0.5px;
}
.login-error {
  background: #ff4a4a22;
  color: var(--danger);
  padding: 9px 0 9px 0;
  border-radius: 6px;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 1em;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-card .form-group {
  text-align: left;
}
.login-card label {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 5px;
  display: block;
}
.login-card input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt);
  font-size: 1em;
  margin-bottom: 2px;
  transition: border 0.19s;
}
.login-card input[type="password"]:focus {
  border-color: var(--accent);
  outline: none;
}
.login-btn {
  width: 100%;
  background: linear-gradient(120deg, #232d46 0%, #2aa6f7 100%);
  color: #fff;
  padding: 13px 0;
  border: none;
  border-radius: 6px;
  font-size: 1.15em;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 6px 0 #1ca2e017;
  transition: all 0.12s;
  margin-top: 6px;
}
.login-btn:hover { 
  background: linear-gradient(120deg, #1a2333 0%, #1c8fd9 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px 0 #1ca2e033;
}

.btn-primary,
.btn-success,
.btn-danger,
.btn-outline-primary {
  background: linear-gradient(120deg, #232d46 0%, #2aa6f7 100%) !important;
  border: none !important;
  color: #fff !important;
}
.btn-primary:hover,
.btn-success:hover,
.btn-danger:hover,
.btn-outline-primary:hover {
  background: linear-gradient(120deg, #1a2333 0%, #1c8fd9 100%) !important;
  transform: translateY(-1px);
}