@import url('tokens.css');

/* ============================================================
   App chrome
   ============================================================ */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--color-milk);
  border-bottom: 1px solid var(--color-mint-50);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo img { height: 40px; width: auto; display: block; }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-name {
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  font-size: 22px;
  color: var(--color-connect-dark);
}
.logo-tag {
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--color-muted-teal);
  text-transform: uppercase;
  margin-top: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.app-header nav {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  font-family: var(--font-body);
  font-size: 13px;
}
.app-header nav a {
  font-weight: var(--fw-semibold);
  color: var(--color-connect-dark);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
}
.app-header nav a:hover {
  background: var(--color-mint-50);
  text-decoration: none;
}
.app-header nav .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--color-mint-50);
  color: var(--color-connect-dark);
  font-weight: var(--fw-semibold);
  font-size: 12px;
}

.lang-switcher {
  position: relative;
}

.lang-switcher summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-mint-50);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--color-connect-dark);
  user-select: none;
  transition: background var(--transition-fast);
}
.lang-switcher summary::-webkit-details-marker { display: none; }
.lang-switcher summary::after {
  content: '';
  display: inline-block;
  width: 10px; height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2372a2ad' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
  transition: transform var(--transition-fast);
}
.lang-switcher[open] summary { background: var(--color-mint-serenity); }
.lang-switcher[open] summary::after { transform: rotate(180deg); }
.lang-switcher summary:hover { background: var(--color-mint-serenity); }
.lang-switcher summary:focus-visible { outline: 2px solid var(--color-muted-teal); outline-offset: 2px; }

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-milk);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--color-mint-50);
  overflow: hidden;
  min-width: 72px;
  z-index: 200;
}
.lang-menu a {
  display: block;
  padding: 9px 16px;
  font-family: var(--font-body);
  font-weight: var(--fw-bold);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--color-connect-dark);
  text-decoration: none;
  transition: background var(--transition-fast);
}
.lang-menu a:hover { background: var(--color-mint-50); text-decoration: none; }
.lang-menu a.active { background: var(--color-connect-dark); color: var(--color-milk); }

main {
  flex: 1 0 auto;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app-footer {
  padding: var(--space-5) var(--space-6);
  text-align: center;
  font-size: 12px;
  color: var(--color-muted-teal);
  background: var(--color-milk);
  border-top: 1px solid var(--color-mint-50);
}
.app-footer .brand-mark {
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  color: var(--color-connect-dark);
}

/* ============================================================
   Layout containers
   ============================================================ */

.shell {
  width: 100%;
  max-width: 920px;
  padding: var(--space-7) var(--space-6);
}
.shell-narrow {
  max-width: 460px;
}
.shell-wide {
  max-width: 1080px;
}

.card {
  background: var(--color-milk);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}
.card-mint {
  background: var(--color-mint-50);
}

/* ============================================================
   Hero band (landing)
   ============================================================ */

.hero {
  position: relative;
  background: var(--color-mint-serenity);
  color: var(--color-connect-dark);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-7) var(--space-8);
  overflow: hidden;
  margin-bottom: var(--space-6);
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  margin: 0 0 var(--space-3);
}
.hero p { max-width: 560px; margin: 0; }
.hero::after {
  content: '';
  position: absolute;
  right: -120px; top: -120px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: var(--color-mint-50);
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }

/* ============================================================
   Buttons (pill, always)
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 11px 24px;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: opacity var(--transition-fast), background var(--transition-fast);
  text-decoration: none;
  line-height: 1;
}
.btn:hover { opacity: 0.88; text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--color-muted-teal); outline-offset: 2px; }

.btn-primary  { background: var(--color-connect-dark); color: var(--color-milk); }
.btn-mint     { background: var(--color-mint-serenity); color: var(--color-connect-dark); }
.btn-outline  { background: transparent; color: var(--color-connect-dark); box-shadow: inset 0 0 0 2px var(--color-connect-dark); }
.btn-ghost    { background: transparent; color: var(--color-connect-dark); }
.btn-danger   { background: var(--color-happy-purple); color: var(--color-white); }

.btn-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-5);
  flex-wrap: wrap;
}

/* ============================================================
   Forms
   ============================================================ */

form .field { display: flex; flex-direction: column; margin-bottom: var(--space-4); }

label {
  font-family: var(--font-body);
  font-weight: var(--fw-semibold);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted-teal);
  margin-bottom: 6px;
}

input[type=text],
input[type=password],
input[type=email],
input[type=url],
textarea {
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 16px;
  border: 2px solid var(--color-mint-50);
  border-radius: var(--radius-md);
  background: var(--color-white);
  color: var(--color-connect-dark);
  transition: border-color var(--transition-fast);
  width: 100%;
}
textarea { font-family: var(--font-mono); font-size: 13px; line-height: 1.55; min-height: 96px; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--color-muted-teal);
}
input::placeholder, textarea::placeholder { color: var(--color-grey-mid); }

.checkbox-row {
  display: flex; align-items: center; gap: 10px;
  text-transform: none; letter-spacing: 0;
  font-size: 14px; font-weight: var(--fw-regular); color: var(--color-connect-dark);
}
.checkbox-row input { width: auto; }

.error {
  display: block;
  margin-top: var(--space-3);
  padding: 10px 14px;
  background: rgba(160, 43, 147, 0.08);
  border-left: 4px solid var(--color-happy-purple);
  color: var(--color-happy-purple);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

span.error {
  background: transparent;
  border-left: none;
  padding: 4px 0 0;
  font-size: 12px;
  color: var(--color-happy-purple);
}

/* ============================================================
   Auth surfaces
   ============================================================ */

.auth-card {
  background: var(--color-milk);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  margin: var(--space-6) auto;
  max-width: 420px;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  left: -60px; bottom: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: var(--color-mint-50);
  z-index: 0;
}
.auth-card > * { position: relative; z-index: 1; }
.auth-card h1 {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  margin-bottom: var(--space-2);
}
.auth-card .eyebrow { margin-bottom: var(--space-5); }
.auth-card button[type=submit] { width: 100%; margin-top: var(--space-3); }

/* ============================================================
   Dot list (NEVER arrows / chevrons)
   ============================================================ */

.dot-list { list-style: none; padding: 0; margin: 0; }
.dot-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 10px 0;
}
.dot-list li::before {
  content: '';
  flex: 0 0 10px;
  width: 10px; height: 10px;
  margin-top: 9px;
  border-radius: 50%;
  background: var(--color-muted-teal);
}
.dot-list li.muted::before { background: var(--color-mint-50); }
.dot-list a { font-weight: var(--fw-semibold); }

.claim-list {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
}
.claim-list li {
  display: flex;
  gap: var(--space-3);
  padding: 6px 0;
  border-bottom: 1px solid var(--color-mint-50);
}
.claim-list li:last-child { border-bottom: none; }
.claim-list .k { color: var(--color-muted-teal); min-width: 200px; }
.claim-list .v { color: var(--color-connect-dark); word-break: break-all; }

/* ============================================================
   Badges / pills
   ============================================================ */

.badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 10px;
  padding: 4px 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: var(--fw-bold);
  border-radius: var(--radius-pill);
  background: var(--color-muted-teal);
  color: var(--color-milk);
}
.badge-mint { background: var(--color-mint-serenity); color: var(--color-connect-dark); }
.badge-soft { background: var(--color-mint-50); color: var(--color-connect-dark); }
.badge-danger { background: var(--color-happy-purple); color: var(--color-white); }

/* ============================================================
   Admin: clients table
   ============================================================ */

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.table-wrap {
  background: var(--color-milk);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table.clients {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 14px;
}
table.clients thead {
  background: var(--color-mint-50);
}
table.clients th {
  text-align: left;
  padding: 14px 18px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted-teal);
  font-weight: var(--fw-bold);
}
table.clients td {
  padding: 16px 18px;
  border-top: 1px solid var(--color-mint-50);
  color: var(--color-connect-dark);
  vertical-align: middle;
}
table.clients tr:hover td { background: rgba(183, 227, 237, 0.18); }
table.clients td.actions { text-align: right; white-space: nowrap; }
table.clients td.actions a {
  font-weight: var(--fw-semibold);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-mint-50);
  color: var(--color-connect-dark);
}
table.clients td.actions a:hover { background: var(--color-mint-serenity); text-decoration: none; }
table.clients td.actions .delete { background: rgba(160, 43, 147, 0.1); color: var(--color-happy-purple); }
table.clients td.actions .delete:hover { background: rgba(160, 43, 147, 0.2); }

.empty-state {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  color: var(--color-muted-teal);
  background: var(--color-milk);
  border-radius: var(--radius-lg);
}

/* ============================================================
   Misc
   ============================================================ */

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.section-title .bar {
  width: 6px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--color-muted-teal);
}

/* ============================================================
   Responsive — mobile & popup-size
   ============================================================ */

body { overflow-x: hidden; }

@media (max-width: 600px) {
  .app-header {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
  }
  .logo img { height: 32px; }
  .logo-tag { display: none; }
  .logo-name { font-size: 18px; }

  .lang-switcher summary { font-size: 10px; padding: 5px 10px; }

  .shell {
    /* main now vertically centers — drop vertical padding */
    padding: var(--space-3) var(--space-4);
  }

  .auth-card {
    padding: var(--space-5);
    margin: 0 auto;
    border-radius: var(--radius-md);
  }
  .auth-card h1 { font-size: 1.6rem; }
  .auth-card .btn { width: 100%; }
  .auth-card .btn + .btn { margin-top: var(--space-2); }

  .app-footer {
    padding: var(--space-3) var(--space-4);
  }
}

@media (max-width: 400px) {
  .app-header {
    padding: var(--space-2) var(--space-3);
  }
  .header-right { gap: var(--space-2); }
  .lang-switcher summary { font-size: 10px; padding: 4px 8px; }

  .shell {
    padding: var(--space-2) var(--space-3);
  }

  .auth-card {
    padding: var(--space-4);
    margin: 0 auto;
  }

  .app-footer { font-size: 11px; padding: var(--space-2) var(--space-3); }
}

/* Short windows — tighten spacing so footer stays in viewport */
@media (max-height: 640px) {
  .shell { padding: var(--space-2) var(--space-4); }

  .auth-card {
    padding: var(--space-4);
    margin: 0 auto;
  }
  .auth-card h1 { font-size: 1.4rem; margin-bottom: var(--space-2); }
  .auth-card .eyebrow { margin-bottom: var(--space-2); }
  form .field { margin-bottom: var(--space-3); }
}

/* Very short — footer gone, no room */
@media (max-height: 480px) {
  .app-footer { display: none; }
}
