/* =====================================================================
   bwic.css — Shared styles for BWIC CakePHP App
   Matches the BWIC-responsive2 WebsiteBaker template design
   ===================================================================== */

/* ── Fonts ── */
@font-face {
  font-family: 'Inter';
  font-weight: 300;
  src: url('../fonts/inter/inter-300.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-weight: 400;
  src: url('../fonts/inter/inter-400.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-weight: 500;
  src: url('../fonts/inter/inter-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Inter';
  font-weight: 600;
  src: url('../fonts/inter/inter-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 500;
  src: url('../fonts/barlow/barlow-500.ttf') format('truetype');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 600;
  src: url('../fonts/barlow/barlow-600.ttf') format('truetype');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 700;
  src: url('../fonts/barlow/barlow-700.ttf') format('truetype');
}

/* ── Design Tokens ── */
:root {
  --yellow:    #F3B110;
  --yellow-lt: #FDF3D5;
  --yellow-dk: #D99E0A;
  --black:     #1C1C1C;
  --gray-700:  #374151;
  --gray-500:  #6B7280;
  --gray-300:  #D1D5DB;
  --gray-100:  #F3F4F6;
  --white:     #FFFFFF;
  --radius:    7px;
  --shadow:    0 1px 4px rgba(0,0,0,.08);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; }

body {
  font-family: 'Inter', Arial, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.65;
  color: var(--gray-700);
  background: var(--white);
  margin: 0;
  padding: 0;
}

a:link, a:visited {
  color: var(--yellow-dk);
  text-decoration: none;
  font-weight: 500;
}
a:hover { color: var(--black); text-decoration: underline; }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Barlow Condensed', Arial Narrow, sans-serif;
  font-weight: 700;
  color: var(--black);
  line-height: 1.2;
  margin: 0 0 10px;
  background: none;
}
h1 { font-size: 2em; }
h2 { font-size: 1.6em; }
h3 { font-size: 1.3em; }
h4 { font-size: 1.05em; }

p { margin: 0 0 12px; }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  border: none;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

table th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--gray-100);
  color: var(--gray-500);
  border-bottom: 2px solid var(--yellow);
}

table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

table td[rowspan] { vertical-align: top; }

table tr:hover td { background: var(--yellow-lt); }
table tr.altrow td { background: var(--gray-100); }
table tr.altrow:hover td { background: var(--yellow-lt); }

/* First column (date/year/id) stays compact; skip if it's also an actions column */
table td:first-child:not(.actions),
table th:first-child:not(.actions) {
  white-space: nowrap;
  width: 1%;
}

/* ── Forms ── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--gray-700);
  background: var(--white);
  transition: border-color .15s;
  box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(243,177,16,.15);
}

input[type="submit"],
button[type="submit"],
.button {
  display: inline-block;
  padding: 9px 22px;
  background: var(--yellow);
  color: var(--black);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
/* Override link pseudo-classes which have higher specificity than .button */
a.button,
a.button:link,
a.button:visited {
  color: var(--black);
}
input[type="submit"]:hover, button[type="submit"]:hover, .button:hover,
a.button:hover {
  background: var(--yellow-dk);
  color: var(--black);
  text-decoration: none;
}

.button.secondary,
a.button.secondary, a.button.secondary:link, a.button.secondary:visited {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.button.secondary:hover { background: var(--gray-300); color: var(--gray-700); }

.button.alert,
a.button.alert, a.button.alert:link, a.button.alert:visited {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
}
.button.alert:hover { background: #FECACA; color: #991B1B; }

label {
  display: block;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.input { margin-bottom: 16px; }

fieldset {
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

legend {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--black);
  padding: 0 8px;
}

/* ── Flash messages ── */
.message, .flash-message {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-weight: 500;
  font-size: 0.9rem;
}

.message.success  { background: #DCFCE7; color: #166534; border-left: 4px solid #4ADE80; }
.message.error    { background: #FEE2E2; color: #991B1B; border-left: 4px solid #F87171; }
.message.warning  { background: var(--yellow-lt); color: #92400E; border-left: 4px solid var(--yellow); }
.message.info     { background: #EFF6FF; color: #1E40AF; border-left: 4px solid #60A5FA; }

/* ── Cards / content boxes ── */
.card {
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  background: var(--white);
}

.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--black);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--yellow);
  display: inline-block;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 20px 0;
  flex-wrap: wrap;
}

.pagination li a,
.pagination li span {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 5px;
  font-size: 0.85rem;
  color: var(--gray-700);
  text-decoration: none;
  transition: all .12s;
}

.pagination li.current span,
.pagination li a:hover {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--black);
  font-weight: 600;
}

.pagination li.disabled span { color: var(--gray-300); border-color: var(--gray-100); }

/* ── Table: action cells (td/th.actions) ── */
td.actions, th.actions {
  white-space: nowrap;
  text-align: left;
  /* kein width: 1% — schadet wenn mehrere Datenspalten diese Klasse tragen */
}

td.actions a,
td.actions button {
  display: inline-block;
  margin-right: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--yellow-dk);
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: all .12s;
  white-space: nowrap;
}

td.actions a:last-child { margin-right: 0; }

td.actions a:hover {
  background: var(--yellow-lt);
  border-color: var(--yellow);
  color: var(--black);
  text-decoration: none;
}

/* ── Actions sidebar block (div.actions) ── */
div.actions {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-top: 3px solid var(--yellow);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
}

div.actions h3 {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
}

div.actions ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

div.actions li { margin-bottom: 6px; }

div.actions li a {
  font-size: 0.88rem;
  color: var(--yellow-dk);
  font-weight: 500;
  text-decoration: none;
}
div.actions li a:hover { color: var(--black); }

/* ── Admin sidebar (Foundation remnants: large-3 columns, side-nav) ── */
#actions-sidebar,
nav.large-3 {
  width: 220px;
  flex-shrink: 0;
  float: left;
}

ul.side-nav {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-top: 3px solid var(--yellow);
  border-radius: var(--radius);
  overflow: hidden;
}

ul.side-nav li {
  border-bottom: 1px solid var(--gray-100);
  padding: 0;
  margin: 0;
}

ul.side-nav li:last-child { border-bottom: none; }

ul.side-nav li.heading {
  padding: 8px 14px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gray-500);
  background: var(--gray-100);
}

ul.side-nav li a {
  display: block;
  padding: 9px 14px;
  font-size: 0.88rem;
  color: var(--gray-700);
  text-decoration: none;
  font-weight: 400;
  transition: background .12s, color .12s;
}

ul.side-nav li.active a,
ul.side-nav li a.active {
  background: var(--yellow-lt);
  color: var(--black);
  font-weight: 600;
}

ul.side-nav li a:hover {
  background: var(--gray-100);
  color: var(--black);
  text-decoration: none;
}

/* ── Admin 2-spalten Layout (Foundation large-X columns) ── */
.large-9.columns.content,
.large-9.content {
  margin-left: 240px;   /* Platz für Sidebar */
  min-width: 0;
}

/* Clearfix für Float-Layout */
.large-9.columns.content::after,
.large-3.columns::after {
  content: '';
  display: table;
  clear: both;
}

/* ── Related records ── */
.related h3 {
  font-size: 1rem;
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-300);
  color: var(--gray-500);
}

/* ── Utilities ── */
.smallfont   { font-size: 0.85rem; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }
.text-center { text-align: center; }
.float-right { float: right; }
.float-left  { float: left; }

dl dt { font-weight: 600; color: var(--black); margin-top: 8px; }
dl dd { margin-left: 0; color: var(--gray-700); margin-bottom: 4px; }
dl dt.altrow, dl dd.altrow { background: var(--gray-100); padding: 2px 6px; }

/* ── Wrapper für Seiteninhalte (CakePHP-Konvention) ── */
[class*=" index"],
[class*=" view"],
[class*=" form"] {
  max-width: 100%;
}

/* ── Paginator ── */
.paginator p { font-size: 0.82rem; color: var(--gray-500); margin-top: 8px; }

/*
 * Rangliste-Tabellen (gesamtwertung/rangliste):
 * table-layout: fixed + feste Breiten für Platz und Punkte stellen sicher,
 * dass alle drei Tabellen (Männer/Frauen/Mixed) identisch proportioniert
 * sind, unabhängig von der Namenslänge in der mittleren Spalte.
 * font-variant-numeric: tabular-nums lässt Dezimalstellen bündig stehen.
 */
.rangliste-table { table-layout: fixed; }

table.rangliste-table th:nth-child(1),
table.rangliste-table td:nth-child(1) {
  width: 44px;
  text-align: center;
}

table.rangliste-table th:nth-child(3),
table.rangliste-table td:nth-child(3) {
  width: 90px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Im breiten Layout ist der Platz in der eigenen Spalte sichtbar — Inline-Span verstecken */
.platz-inline {
  display: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-right: 2px;
}

/*
 * Schmale Viewports (z.B. Sidebar-iframe ≤ 480px):
 * Platz-Spalte ausblenden, Platznummer stattdessen inline vor dem Namen anzeigen.
 * table-layout: auto — Name und Punkte teilen sich die volle Breite sinnvoll auf.
 */
@media (max-width: 480px) {
  .rangliste-table { table-layout: auto; }

  table.rangliste-table th:nth-child(1),
  table.rangliste-table td:nth-child(1) { display: none; }

  table.rangliste-table th:nth-child(3),
  table.rangliste-table td:nth-child(3) { width: auto; }

  .platz-inline { display: inline; }
}

/* ══════════════════════════════════════════════════════════════════════
   Responsive — Mobilgeräte
   ══════════════════════════════════════════════════════════════════════ */

/*
 * Tabellen-Scroll-Wrapper:
 * JavaScript in singlepage.php und admin.php wickelt alle Tabellen
 * automatisch in ein <div class="table-scroll"> ein, damit sie auf
 * schmalen Bildschirmen horizontal gescrollt werden können, ohne
 * die Seite zu sprengen.
 */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;  /* Inertia-Scroll auf iOS */
  margin-bottom: 16px;
}
.table-scroll table { margin-bottom: 0; }

/*
 * Admin-Sidebar (Foundation-Klassen large-3 / large-9):
 * Unterhalb 860px stapeln sich Sidebar und Inhalt vertikal statt
 * nebeneinander zu schweben (Float-Layout).
 */
@media (max-width: 860px) {
  #actions-sidebar,
  nav.large-3 {
    float: none;
    width: 100%;
    margin-bottom: 16px;
  }

  .large-9.columns.content,
  .large-9.content {
    margin-left: 0;
  }
}
