/* public_html/assets/css/base/base.css */
/* ServexHub — Base Styles (responsive + sticky footer) */

@import url("./tokens.css");

/* ============ CSS Reset (soft) ============ */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-root);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);

  /* Sticky footer foundation */
  min-height: 100dvh;           /* modern viewport */
  display: flex;
  flex-direction: column;
}

/* ✅ IMPORTANT: app-shell must stretch and be a column flex container */
.app-shell{
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

img, svg, video { max-width: 100%; height: auto; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hov); text-decoration: underline; }

::selection { background: rgba(20,108,165,.18); }

/* Prevent layout break with long tokens (Arabic/URLs) */
p, h1, h2, h3, h4, h5, h6, li, td, th, .break-anywhere {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ============ Containers ============ */
.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ============ App Layout Helpers ============ */
/* main should stretch to push footer down */
.app-main { flex: 1 0 auto; }

/* footer sits at bottom even if page empty */
.app-footer { flex: 0 0 auto; min-height: var(--footer-min-h); }

/* Optional header helper */
.app-header { min-height: var(--header-min-h); }

/* ============ Typography ============ */
h1, h2, h3, h4 {
  margin: 0 0 var(--s-3);
  line-height: var(--lh-title);
  letter-spacing: var(--ls-title);
  font-weight: var(--fw-bold);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); font-weight: var(--fw-bold); }
h3 { font-size: var(--fs-h3); font-weight: var(--fw-semibold); }
h4 { font-size: var(--fs-h4); font-weight: var(--fw-semibold); }

p { margin: 0 0 var(--s-3); color: var(--ink); }
small { font-size: var(--fs-12); color: var(--muted); }

/* UI text helpers */
.muted { color: var(--muted) !important; }
.fw-regular { font-weight: var(--fw-regular) !important; }
.fw-semibold { font-weight: var(--fw-semibold) !important; }
.fw-bold { font-weight: var(--fw-bold) !important; }

/* ============ Cards / Surfaces ============ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card.pad { padding: var(--s-5); }

.hr {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: var(--s-5) 0;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-14);
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: transform .06s ease, filter .12s ease, background .12s ease;
  text-decoration: none;
}

.btn:hover { background: var(--brand-hov); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(.1);
}

.btn.outline {
  background: transparent;
  color: var(--brand);
  border-color: var(--line-strong);
}

.btn.outline:hover {
  background: rgba(11,92,171,.06);
}

.btn.danger {
  background: var(--bad);
}
.btn.danger:hover { filter: brightness(1.05); }

/* ============ Inputs ============ */
.input,
select,
textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="url"]{
  width: 100%;
  background: var(--input);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: var(--fs-16);
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}

textarea { min-height: 120px; resize: vertical; }

.input:focus,
select:focus,
textarea:focus,
input:focus{
  border-color: var(--focus);
  box-shadow: 0 0 0 4px rgba(148,195,255,.25);
}

/* ============ Chips / Badges ============ */
.chip{
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: var(--fs-13);
  line-height: 1.2;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
}

.chip.ok   { color: var(--ok);   background: var(--ok-bg);   border-color: var(--ok-br); }
.chip.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-br); }
.chip.bad  { color: var(--bad);  background: var(--bad-bg);  border-color: var(--bad-br); }

/* ============ Tables ============ */
.table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--card);
}

.table th, .table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  text-align: start;
  vertical-align: top;
  font-size: var(--fs-14);
}

.table th { background: rgba(11,92,171,.04); font-weight: var(--fw-semibold); }
.table tr:last-child td { border-bottom: 0; }

/* ============ Accessibility / Motion ============ */
:focus-visible {
  outline: 3px solid rgba(148,195,255,.55);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce){
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* ============ Responsive refinements ============ */
/* Mobile: tighten paddings slightly */
@media (max-width: 480px){
  .container { padding-inline: 12px; }
  .card.pad { padding: var(--s-4); }
  .btn { padding: 10px 12px; }
  .table th, .table td { padding: 10px; }
}

/* Tablet: keep comfortable spacing */
@media (min-width: 768px){
  .container { padding-inline: 18px; }
}

/* Desktop+ : slightly larger comfortable UI without blowing up */
@media (min-width: 1200px){
  .container { padding-inline: 20px; }
}
