/* ── Panel Login Theme (Roundcube replacement) ── */
*, *::before, *::after {
  box-sizing: border-box;
}

.login-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #08080c;
}

.login-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(59,130,246,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(99,102,241,0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(139,92,246,0.04) 0%, transparent 40%);
  animation: login-glow 12s ease-in-out infinite alternate;
}

@keyframes login-glow {
  0%   { transform: translate(0, 0) scale(1); opacity: 0.8; }
  33%  { transform: translate(2%, -1%) scale(1.05); opacity: 1; }
  66%  { transform: translate(-1%, 1%) scale(1.02); opacity: 0.85; }
  100% { transform: translate(1%, -0.5%) scale(1.08); opacity: 0.95; }
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  will-change: transform;
  pointer-events: none;
}

.login-orb--1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(59,130,246,0.15), transparent 70%);
  top: -15%; left: -8%;
  animation: orb-drift-1 18s ease-in-out infinite alternate;
}

.login-orb--2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99,102,241,0.1), transparent 70%);
  bottom: -18%; right: -5%;
  animation: orb-drift-2 22s ease-in-out infinite alternate;
}

.login-orb--3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(139,92,246,0.08), transparent 70%);
  top: 40%; left: 55%;
  animation: orb-drift-3 15s ease-in-out infinite alternate;
}

@keyframes orb-drift-1 {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(60px, 40px) scale(1.1); }
  100% { transform: translate(30px, -30px) scale(0.95); }
}

@keyframes orb-drift-2 {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-40px, -50px) scale(1.15); }
  100% { transform: translate(-20px, 30px) scale(0.9); }
}

@keyframes orb-drift-3 {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -20px) scale(1.1); }
  66%  { transform: translate(-20px, 40px) scale(0.95); }
  100% { transform: translate(10px, -10px) scale(1.05); }
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 70%);
  animation: login-grid-scroll 30s linear infinite;
}

@keyframes login-grid-scroll {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(40px, 40px); }
}

.login-grain {
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 380px;
  margin: 0 0.75rem;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(12,12,20,0.75);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03) inset,
    0 8px 40px rgba(0,0,0,0.4),
    0 0 80px rgba(59,130,246,0.03);
  overflow: visible;
}

.login-card-header {
  text-align: center;
  padding: 2.25rem 2rem 0.25rem;
}

.login-card-body {
  padding: 1rem 2rem 1.5rem;
}

.login-card-footer {
  padding: 0 2rem 1.75rem;
  text-align: center;
}

.login-logo {
  height: 36px;
  width: auto;
  filter: drop-shadow(0 0 20px rgba(59,130,246,0.15));
}

.logo-light { display: none; }
.light-mode .logo-dark { display: none !important; }
.light-mode .logo-light { display: inline !important; }

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.3);
  pointer-events: none;
}

.login-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: #e4e4ec;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.login-input:focus {
  border-color: rgba(59,130,246,0.3);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.08);
}

.login-input::placeholder {
  color: rgba(255,255,255,0.25);
}

.login-btn {
  width: 100%;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(59,130,246,0.25);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}

.login-btn:hover::before {
  transform: translateX(100%);
}

.login-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.15);
  color: #f87171;
  margin-bottom: 12px;
}

.login-lock {
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(255,255,255,0.25);
}

/* ── Theme toggle ── */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ── Light mode ── */
.light-mode .login-bg {
  background: #f8f9fc;
}

.light-mode .login-bg::before {
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(59,130,246,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(99,102,241,0.04) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(139,92,246,0.02) 0%, transparent 40%);
}

.light-mode .login-orb--1 {
  background: radial-gradient(circle, rgba(59,130,246,0.08), transparent 70%);
}

.light-mode .login-orb--2 {
  background: radial-gradient(circle, rgba(99,102,241,0.06), transparent 70%);
}

.light-mode .login-orb--3 {
  background: radial-gradient(circle, rgba(139,92,246,0.04), transparent 70%);
}

.light-mode .login-grid {
  background-image: radial-gradient(circle, rgba(0,0,0,0.06) 1px, transparent 1px);
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black 20%, transparent 70%);
}

.light-mode .login-grain {
  opacity: 0.015;
}

.light-mode .login-card {
  border: 1px solid rgba(0,0,0,0.06);
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.8) inset,
    0 8px 40px rgba(0,0,0,0.08),
    0 0 80px rgba(59,130,246,0.02);
}

.light-mode .field label {
  color: rgba(0,0,0,0.5);
}

.light-mode .input-icon {
  color: rgba(0,0,0,0.3);
}

.light-mode .login-input {
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(0,0,0,0.02);
  color: #1e293b;
}

.light-mode .login-input:focus {
  border-color: rgba(59,130,246,0.4);
  background: rgba(255,255,255,0.8);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.light-mode .login-input::placeholder {
  color: rgba(0,0,0,0.25);
}

.light-mode .login-lock {
  color: rgba(0,0,0,0.25);
}

.light-mode .theme-toggle {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.06);
  color: rgba(0,0,0,0.4);
}

.light-mode .theme-toggle:hover {
  background: rgba(0,0,0,0.08);
  color: #000;
}

/* ── Light mode for Roundcube interface ── */
body.light-mode,
.light-mode body {
  background: #ffffff;
  color: #1e293b;
}

.light-mode #taskmenu {
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
}

.light-mode #taskmenu .button {
  color: #64748b;
}

.light-mode #taskmenu .button:hover {
  background: rgba(0,0,0,0.04);
  color: #1e293b;
}

.light-mode #taskmenu .button.selected {
  background: rgba(0,130,248,0.08);
  color: #2563eb;
  border-left: 3px solid #3b82f6;
}

.light-mode #layout-menu {
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
}

.light-mode #layout-menu .button {
  color: #64748b;
}

.light-mode #layout-menu .button:hover {
  background: rgba(0,0,0,0.04);
  color: #1e293b;
}

.light-mode #layout-menu .button.selected {
  background: rgba(0,130,248,0.08);
  color: #2563eb;
}

.light-mode #layout-menu .button.selected .buttontitle {
  color: #2563eb;
}

.light-mode .listing li.selected {
  background: rgba(0,130,248,0.06);
}

.light-mode .listing li.selected .listitem {
  background: rgba(0,130,248,0.06);
}

.light-mode .listing tbody tr.selected td {
  background: rgba(0,130,248,0.06);
}

.light-mode .toolbar a.button:hover {
  background: rgba(0,130,248,0.05);
}

.light-mode .toolbar a.button.active {
  background: rgba(0,130,248,0.08);
}

.light-mode #layout-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
}

.light-mode #layout-footer a {
  color: #64748b;
}

.light-mode #layout-footer a:hover {
  color: #1e293b;
}

.light-mode ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

.light-mode ::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.light-mode ::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.light-mode html {
  background: #ffffff;
}

/* ── Roundcube interface (mail, settings, addressbook) ── */
:root {
  --psm-blue: #0082F8;
  --psm-blue-dark: #1C40F2;
  --psm-navy: #001042;
  --psm-bg-dark: #0a1628;
  --psm-sidebar: #0f1a2e;
  --psm-text-light: #94a3b8;
  --psm-text-white: #f1f5f9;
  --psm-border: #1e293b;
  --psm-danger: #ef4444;
  --psm-success: #22c55e;
}

#taskmenu {
  background: var(--psm-sidebar);
}

#taskmenu .button {
  color: var(--psm-text-light);
  transition: all 0.15s ease;
}

#taskmenu .button:hover {
  background: rgba(255,255,255,0.06);
  color: var(--psm-text-white);
}

#taskmenu .button.selected {
  background: linear-gradient(135deg, rgba(0,130,248,0.2) 0%, rgba(28,64,242,0.15) 100%);
  color: #60a5fa;
  border-left: 3px solid var(--psm-blue);
}

#taskmenu .button .button-inner {
  padding-left: 36px;
}

#layout-menu {
  background: var(--psm-sidebar);
  border-right: 1px solid var(--psm-border);
}

#layout-menu .button {
  color: var(--psm-text-light);
}

#layout-menu .button:hover {
  background: rgba(255,255,255,0.06);
  color: var(--psm-text-white);
}

#layout-menu .button.selected {
  background: rgba(0,130,248,0.15);
  color: #60a5fa;
}

#layout-menu .button.selected .buttontitle {
  color: #60a5fa;
}

button.btn.primary,
a.btn.primary {
  background: linear-gradient(135deg, var(--psm-blue) 0%, var(--psm-blue-dark) 100%);
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-weight: 600;
  color: #fff;
  transition: all 0.2s ease;
}

button.btn.primary:hover,
a.btn.primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.listing li.selected {
  background: rgba(0,130,248,0.08);
  color: var(--psm-navy);
}

.listing li.selected .listitem {
  background: rgba(0,130,248,0.08);
}

.listing tbody tr.selected td {
  background: rgba(0,130,248,0.08);
}

.toolbar a.button:hover {
  background: rgba(0,130,248,0.06);
}

.toolbar a.button.active {
  background: rgba(0,130,248,0.1);
  color: var(--psm-blue) !important;
}

.quotabar .value {
  background: linear-gradient(90deg, var(--psm-blue), var(--psm-blue-dark));
  border-radius: 4px;
}

.quotabar {
  background: #e2e8f0;
  border-radius: 4px;
  height: 8px;
}

.popover.menu .item a:hover {
  background: rgba(0,130,248,0.08);
  color: var(--psm-blue);
}

.popover.menu .item a.active {
  background: rgba(0,130,248,0.12);
  color: var(--psm-blue);
}

.row.selected {
  background: rgba(0,130,248,0.06);
}

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

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

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

#layout-footer {
  background: var(--psm-sidebar);
  border-top: 1px solid var(--psm-border);
  color: var(--psm-text-light);
}

#layout-footer a {
  color: var(--psm-text-light);
}

#layout-footer a:hover {
  color: var(--psm-text-white);
}

html {
  background: #f1f5f9;
}

body {
  background: #f1f5f9;
  color: #1e293b;
}

a, .link {
  color: var(--psm-blue);
}

a:hover, .link:hover {
  color: var(--psm-blue-dark);
}

.popupmenu .item a:hover {
  background: rgba(0,130,248,0.08);
  color: var(--psm-blue);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--psm-blue) !important;
  box-shadow: 0 0 0 3px rgba(0,130,248,0.1) !important;
}

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

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