/* UI Polish — Desktop layout improvements for Hetzner Dashboard */

/* ===== STICKY NAVBAR ===== */
.h-\[60px\] {
  position: sticky !important;
  top: 0 !important;
  z-index: 50 !important;
  backdrop-filter: blur(12px) !important;
  background-color: rgba(15, 23, 42, 0.92) !important;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5) !important;
}

/* ===== CARD SPACING & HIERARCHY ===== */

/* Main content area: ensure consistent gaps between sections */
.p-6.space-y-6 {
  padding: 1.5rem 2rem !important;
}

/* Grid gaps: uniform 20px between cards */
.grid.grid-cols-3.gap-6 {
  gap: 1.25rem !important;
}
.grid.grid-cols-5.gap-6 {
  gap: 1.25rem !important;
}

/* Card inner padding: more breathing room */
.rounded-xl.p-6 {
  padding: 1.5rem !important;
}
.rounded-xl.p-4 {
  padding: 1.25rem !important;
}

/* ===== TYPOGRAPHY HIERARCHY ===== */

/* Section headings (CPU & Memory, Disk, Docker, etc.) */
.rounded-xl h2.text-xl,
.rounded-xl .text-xl.font-semibold {
  font-size: 1.15rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

/* Big metric values (43%, 32%, 8/8) — make them pop */
.text-5xl {
  font-weight: 700 !important;
  letter-spacing: -0.03em;
}

/* Metric labels (1.6 GB / 3.7 GB, etc.) */
.text-lg.font-semibold {
  font-size: 1rem !important;
  color: #cbd5e1 !important;
}

/* Muted text — slightly more readable */
.text-sm[style*="color: rgb(100"],
.text-sm[style*="color:#64748b"],
.text-\[\#8899aa\] {
  color: #8899aa !important;
}

/* ===== CARD VISUAL REFINEMENT ===== */

/* Cards: subtle border + shadow for depth */
.rounded-xl[style*="border"] {
  border-color: rgba(71, 85, 105, 0.4) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
}

/* Project cards (Poro Manager, Olli-Viestit, Family Dashboard) */
.grid.grid-cols-3.gap-6 > .rounded-xl {
  transition: border-color 0.2s, box-shadow 0.2s !important;
}
.grid.grid-cols-3.gap-6 > .rounded-xl:hover {
  border-color: rgba(102, 126, 234, 0.3) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

/* ===== SERVER INFO STRIP ===== */
#server-info-strip {
  border-color: rgba(71, 85, 105, 0.4) !important;
}

/* ===== TOP INFO GRID: fill full width when only one child ===== */
#top-info-grid:has(> :only-child) {
  grid-template-columns: 1fr !important;
}

/* ===== NAVBAR POLISH ===== */
.h-\[60px\] {
  border-bottom-color: rgba(71, 85, 105, 0.3) !important;
}

/* Bell icon hover effect */
.h-\[60px\] .relative[data-notif-attached] {
  padding: 6px;
  border-radius: 8px;
  transition: background 0.15s;
}
.h-\[60px\] .relative[data-notif-attached]:hover {
  background: rgba(102, 126, 234, 0.12);
}

/* ===== BOTTOM STATUS BAR ===== */
.h-\[50px\] {
  border-top-color: rgba(71, 85, 105, 0.3) !important;
}

/* ===== PROGRESS BARS — more rounded ===== */
.h-1\.5.rounded-full,
.h-2.rounded-full {
  border-radius: 999px !important;
}

/* ===== DONUT CHART LABELS ===== */
/* "Sufficient for X months" — better spacing */
.rounded-xl .flex.items-center.gap-1\.5.text-sm {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(71, 85, 105, 0.2);
}

/* ===== SSL STATUS / SERVICE ITEMS: cleaner rows ===== */
.flex.items-center.justify-between.py-2 {
  padding: 0.625rem 0 !important;
}

/* ===== TABLE IMPROVEMENTS ===== */
table th {
  font-weight: 600 !important;
  text-transform: uppercase !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.05em !important;
  color: #64748b !important;
  padding-bottom: 0.75rem !important;
}
table td {
  padding: 0.5rem 0.75rem !important;
}
table tr + tr {
  border-top: 1px solid rgba(71, 85, 105, 0.15);
}

/* ===== ALERT BANNER — integrate with card style ===== */
#alert-banner {
  margin-bottom: 1rem !important;
}

/* ===== CLIENTS PAGE: 20-column grid ===== */
.grid-cols-20 {
  grid-template-columns: repeat(20, minmax(0, 1fr));
}
@media (max-width: 1023px) {
  .grid-cols-20 {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
}

/* ===== CLIENTS PAGE: column separators & stable rows ===== */
.client-row {
  min-height: 56px;
}
@media (min-width: 1024px) {
  .cell-sep {
    border-right: 1px solid rgba(51, 65, 85, 0.3);
  }
}

/* ===== CLIENTS PAGE: sticky column headers ===== */
#col-headers {
  position: sticky;
  top: 0;
  background: #0f172a;
  z-index: 10;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ===== CLIENTS PAGE: column header tooltips ===== */
.col-tip {
  position: relative;
  cursor: help;
}
.col-tip::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  background: #1e293b;
  border: 1px solid rgba(71, 85, 105, 0.5);
  border-radius: 10px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  width: max-content;
  max-width: 240px;
  line-height: 1.5;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.col-tip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: rgba(71, 85, 105, 0.5);
  z-index: 51;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.col-tip:hover::after,
.col-tip:hover::before {
  opacity: 1;
}
/* Prevent tooltip overflow on left/right edges */
.col-tip:first-child::after { left: 0; transform: none; }
.col-tip:first-child::before { left: 16px; transform: none; }
.col-tip:last-child::after { left: auto; right: 0; transform: none; }
.col-tip:last-child::before { left: auto; right: 8px; transform: none; }

/* ===== WIDGET LAYOUT MANAGER ===== */

/* Container — flex-wrap layout replaces space-y */
#widget-container {
  display: flex !important;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-content: flex-start;
}

/* Every widget: full width by default */
.hd-widget {
  flex: 0 0 100%;
  max-width: 100%;
  min-width: 0;
}

/* Half-width widget */
.hd-widget.hd-widget-half {
  flex: 0 0 calc(50% - 0.375rem);
  max-width: calc(50% - 0.375rem);
  min-width: 0;
}

/* Hidden widget (overrides Alpine x-show inline display) */
.hd-widget-hidden {
  display: none !important;
}

/* Edit mode outline on container */
#widget-container.hd-edit-active {
  outline: 2px dashed rgba(99,102,241,0.25);
  outline-offset: 4px;
  border-radius: 12px;
}

/* ---- Edit bar ---- */
.hd-edit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 8px 8px 0 0;
  margin-bottom: -1px;
  position: relative;
  z-index: 10;
}

.hd-drag-handle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: grab;
  color: #6366f1;
  padding: 2px 0;
  user-select: none;
}
.hd-drag-handle:active { cursor: grabbing; }

.hd-edit-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.hd-edit-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hd-half-btn,
.hd-hide-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid rgba(99,102,241,0.3);
  background: rgba(99,102,241,0.08);
  color: #818cf8;
}
.hd-half-btn.active {
  background: rgba(99,102,241,0.28);
  border-color: rgba(99,102,241,0.55);
}
.hd-half-btn:hover { background: rgba(99,102,241,0.2); }

.hd-hide-btn {
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.07);
  color: #f87171;
  padding: 2px 6px;
}
.hd-hide-btn:hover { background: rgba(239,68,68,0.18); }

/* ---- Drag ghost/chosen ---- */
.hd-ghost {
  opacity: 0.25 !important;
  background: rgba(99,102,241,0.07) !important;
  outline: 2px dashed rgba(99,102,241,0.4) !important;
  border-radius: 12px;
}
.hd-chosen {
  box-shadow: 0 0 0 2px rgba(99,102,241,0.5);
  border-radius: 12px;
}
.hd-dragging { opacity: 0.85; cursor: grabbing !important; }

/* ---- Toolbar ---- */
#hd-layout-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 4px;
}

#hd-edit-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid rgba(99,102,241,0.3);
  background: rgba(99,102,241,0.08);
  color: #818cf8;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
#hd-edit-btn:hover { background: rgba(99,102,241,0.16); }
#hd-edit-btn.active {
  background: rgba(99,102,241,0.22);
  border-color: rgba(99,102,241,0.55);
  color: #a5b4fc;
}

#hd-reset-btn {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 8px;
  border: 1px solid rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.07);
  color: #f87171;
  cursor: pointer;
  transition: background 0.15s;
}
#hd-reset-btn:hover { background: rgba(239,68,68,0.16); }

/* ---- Hidden panel ---- */
#hd-hidden-panel {
  background: rgba(15,23,42,0.8);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 4px;
}

.hd-hidden-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 8px;
}

#hd-hidden-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hd-restore-btn {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid rgba(34,197,94,0.3);
  background: rgba(34,197,94,0.07);
  color: #86efac;
  cursor: pointer;
  transition: background 0.15s;
}
.hd-restore-btn:hover { background: rgba(34,197,94,0.18); }

/* ===== METRIC CARD LAYOUT ===== */

/* Grid → flex-wrap for metric cards */
#metrics-cards-grid {
  display: flex !important;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
}

/* Default: 1/5 width (5 per row on desktop) */
.hm-card {
  flex: 0 0 calc(20% - 0.6rem);
  min-width: 160px;
  position: relative;
}

/* Width size classes */
.hm-card.hm-s  { flex: 0 0 calc(16.666% - 0.625rem); min-width: 140px; }  /* 6/row */
.hm-card.hm-l  { flex: 0 0 calc(33.333% - 0.5rem);   min-width: 220px; }  /* 3/row */
.hm-card.hm-xl { flex: 0 0 calc(50% - 0.375rem);      min-width: 280px; }  /* 2/row */

/* Hidden metric card */
.hm-card.hm-hidden { display: none !important; }

/* Edit mode active grid outline */
#metrics-cards-grid.hd-edit-active {
  outline: 2px dashed rgba(99,102,241,0.2);
  outline-offset: 4px;
  border-radius: 12px;
}

/* ---- Metric card edit bar (absolute overlay at top) ---- */
.hm-edit-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  background: rgba(15,23,42,0.88);
  border-bottom: 1px solid rgba(99,102,241,0.3);
  border-radius: 11px 11px 0 0;
  backdrop-filter: blur(4px);
  gap: 4px;
}

.hm-drag-handle {
  cursor: grab;
  color: #6366f1;
  display: flex;
  align-items: center;
  padding: 2px 3px;
  border-radius: 4px;
  flex-shrink: 0;
}
.hm-drag-handle:active { cursor: grabbing; }
.hm-drag-handle:hover { background: rgba(99,102,241,0.15); }

.hm-size-btn {
  flex: 1;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #94a3b8;
  background: transparent;
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 4px;
  padding: 1px 4px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.hm-size-btn:hover { background: rgba(99,102,241,0.18); color: #a5b4fc; }

.hm-card-hide-btn {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.hm-card-hide-btn:hover { color: #f87171; background: rgba(239,68,68,0.1); }

/* Drag ghost/chosen for metric cards */
.hm-ghost   { opacity: 0.2 !important; outline: 2px dashed rgba(99,102,241,0.45) !important; border-radius: 12px; }
.hm-chosen  { box-shadow: 0 0 0 2px rgba(99,102,241,0.5); border-radius: 12px; }
.hm-dragging { opacity: 0.85; cursor: grabbing !important; }
