/* Modern app theme for server_project */
:root {
  --app-bg: #0b1220;
  --app-surface: rgba(255, 255, 255, 0.06);
  --app-surface-2: rgba(255, 255, 255, 0.09);
  --app-border: rgba(255, 255, 255, 0.10);
  --app-text: rgba(255, 255, 255, 0.92);
  --app-muted: rgba(255, 255, 255, 0.65);

  --app-accent: #7c3aed; /* violet */
  --app-accent-2: #22c55e; /* green */

  --app-radius: 16px;
  --app-radius-sm: 12px;
  --app-shadow: 0 18px 40px rgba(0,0,0,.35);
  --app-shadow-sm: 0 10px 26px rgba(0,0,0,.25);

  --sidebar-w: 300px;
  --sidebar-w-collapsed: 86px;
  --content-max: 1200px;
}

html, body {
  height: 100%;
}

body {
  min-height: 100vh;
  /* Seamless pattern + soft glows. The first layer repeats cleanly forever. */
  background-color: var(--app-bg);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cpath d='M0 0H160V160H0z' fill='none'/%3E%3Cpath d='M0 0L160 160M160 0L0 160' stroke='%23ffffff' stroke-opacity='0.03' stroke-width='1'/%3E%3Ccircle cx='80' cy='80' r='1' fill='%23ffffff' fill-opacity='0.06'/%3E%3C/svg%3E"),
    radial-gradient(1200px 600px at 20% -10%, rgba(124,58,237,.35), transparent 60%),
    radial-gradient(900px 450px at 90% 10%, rgba(34,197,94,.25), transparent 55%),
    radial-gradient(900px 550px at 40% 120%, rgba(59,130,246,.18), transparent 55%);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat;
  background-size: 420px 420px, auto, auto, auto;
  background-position: 0 0, 0 0, 0 0, 0 0;
  color: var(--app-text);
}

/* Make default bootstrap light backgrounds blend with dark theme */
.bg-light, .bg-white, .table-light {
  background-color: transparent !important;
}

a { color: inherit; }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: rgba(11, 18, 32, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--app-border);
}

.app-topbar-inner {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: .75rem;
  padding: .65rem .75rem;
}

.app-iconbtn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid var(--app-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--app-text);
  text-decoration: none;
}

.app-iconbtn:hover {
  background: rgba(255, 255, 255, 0.10);
}

.app-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  text-decoration: none;
}

.app-brand-title {
  font-weight: 700;
  letter-spacing: .2px;
}

.app-brand-sub {
  font-size: .75rem;
  color: var(--app-muted);
}

.app-main {
  padding: 1rem;
}

.app-content {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Typography */
h1 { font-size: clamp(1.35rem, 1.1rem + 1vw, 2rem); margin-bottom: .25rem; }
.lead { color: var(--app-muted); font-size: 1rem; }

/* Cards */
.card {
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--app-shadow-sm);
}

.card-header {
  background: rgba(255,255,255,0.04) !important;
  border-bottom: 1px solid var(--app-border);
}

.card-body {
  color: var(--app-text);
}

/* Tables */
.table {
  color: var(--app-text);
}

.table thead th {
  color: rgba(255,255,255,.78);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-bg-type: rgba(255,255,255,0.03);
}

.table-responsive {
  border-radius: var(--app-radius-sm);
}

/* Inputs */
.form-control, .form-select {
  border-radius: 14px;
  border-color: rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--app-text);
}

/* Windows/Chrome: dropdown options often render with system (light) background;
   force readable option text so it doesn't look "blank" on open. */
.form-select option,
.form-select optgroup {
  color: #0b1220;
  background: #ffffff;
}

.form-control::placeholder {
  color: rgba(255,255,255,0.45);
}

.form-control:focus, .form-select:focus {
  border-color: rgba(124,58,237,.65);
  box-shadow: 0 0 0 .2rem rgba(124,58,237,.18);
  background: rgba(255,255,255,0.08);
}

.form-label, .form-text { color: var(--app-muted); }

/* Buttons */
.btn {
  border-radius: 14px;
}

.btn-primary {
  background: linear-gradient(135deg, rgba(124,58,237,1), rgba(99,102,241,1));
  border: none;
}

.btn-outline-light {
  border-color: rgba(255,255,255,0.22);
}

/* Accordion */
.accordion-item {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  overflow: hidden;
  background: rgba(255,255,255,0.05);
}

.accordion-button {
  background: rgba(255,255,255,0.04);
  color: var(--app-text);
}

.accordion-button:not(.collapsed) {
  background: rgba(124,58,237,.16);
  color: var(--app-text);
}

/* Offcanvas */
.offcanvas {
  background: rgba(11, 18, 32, 0.92);
  color: var(--app-text);
  border-right: 1px solid var(--app-border);
  backdrop-filter: blur(14px);
}

/* Pro desktop drawer: floats under topbar */
@media (min-width: 992px) {
  :root {
    --topbar-h: 62px;
  }

  .offcanvas {
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    border-top-right-radius: 18px;
    border-bottom-right-radius: 18px;
    box-shadow: var(--app-shadow);
  }
}

.offcanvas-backdrop.show {
  opacity: 0.55;
  backdrop-filter: blur(6px);
}

.offcanvas .list-group-item {
  background: transparent;
  border-color: rgba(255,255,255,0.06);
  color: var(--app-text);
}

.offcanvas .list-group-item:hover {
  background: rgba(255,255,255,0.06);
}

.offcanvas .list-group-item.active {
  background: rgba(124,58,237,.18);
  border-color: rgba(124,58,237,.35);
}

/* Make bootstrap alerts readable */
.alert {
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
  background: rgba(255,255,255,0.06);
  color: var(--app-text);
}

/* --- Dashboard (Mi panel) --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.dashboard-widget {
  grid-column: span 12;
}

@media (min-width: 768px) {
  .dashboard-widget {
    grid-column: span 6;
  }
}

.dashboard-handle {
  display: none;
  user-select: none;
  opacity: 0.8;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: .35rem .5rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: var(--app-text);
}

body.dashboard-edit .dashboard-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body.dashboard-edit .dashboard-handle:hover {
  background: rgba(255,255,255,0.10);
}

body.dashboard-edit .dashboard-widget {
  outline: 1px dashed rgba(255, 255, 255, 0.15);
}

body.dashboard-edit .dashboard-widget.dashboard-selected {
  outline: 2px solid rgba(124,58,237,.55);
  box-shadow: 0 0 0 3px rgba(124,58,237,.14);
}

body.dashboard-edit .dashboard-widget.dragging {
  opacity: 0.7;
  transform: scale(0.995);
}

/* --- Kcal widget chart sizing --- */
.kcal-widget-chart-wrap {
  position: relative;
  height: 170px;
  width: 100%;
  border-radius: var(--app-radius-sm);
  overflow: hidden;
}

.kcal-widget-chart-wrap > canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
