/* OpenScores Design System — Light Theme (warm editorial) */

:root {
  /* Backgrounds */
  --os-bg:          #f9f7f4;   /* warm off-white */
  --os-bg-alt:      #ffffff;   /* card surface */
  --os-bg-tertiary: #f2ede6;   /* section bands */

  /* Text */
  --os-text:        #1a1813;   /* dark brown */
  --os-text-muted:  #6b6458;   /* secondary */

  /* Accents */
  --os-accent:      #c9714f;   /* terracotta */
  --os-accent-hover:#b05c3a;
  --os-accent-cool: #4a7c7e;   /* teal */
  --os-accent-light:#f4e4d4;   /* warm cream highlight */

  /* Borders / shadows */
  --os-border:      #e8ddd3;
  --os-shadow-sm:   0 2px 8px rgba(26, 24, 19, 0.04);
  --os-shadow-md:   0 8px 24px rgba(26, 24, 19, 0.08);
  --os-shadow-lg:   0 16px 48px rgba(26, 24, 19, 0.12);

  /* Radius */
  --os-radius:      8px;
  --os-radius-sm:   2px;

  /* Player accent colors (work on light bg) */
  --os-p1:          #c9714f;   /* terracotta for player 1 */
  --os-p2:          #4a7c7e;   /* teal for player 2 */
}

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

body {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--os-bg);
  color: var(--os-text);
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
  padding: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Crimson Text', serif;
  font-weight: 600;
  color: var(--os-text);
  line-height: 1.2;
  margin: 0;
}

h1 { font-size: 42px; font-style: italic; }
h2 { font-size: 32px; font-style: italic; }
h3 { font-size: 26px; }
h4 { font-size: 20px; }
h5 { font-size: 18px; }
h6 { font-size: 16px; }

/* ==================== HEADER / NAVBAR ==================== */

.os-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--os-border);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 16px 0;
}

.os-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.os-logo {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 26px;
  font-weight: 600;
  color: var(--os-accent);
  text-decoration: none;
  letter-spacing: -0.5px;
  cursor: pointer;
}

.os-header-nav {
  display: flex;
  gap: 28px;
  align-items: center;
}

.os-nav-link {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--os-text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}

.os-nav-link:hover {
  color: var(--os-accent);
}

/* Back button in header */
#backButtonDiv {
  margin-right: auto;
}

.navbar-back-button-container a {
  color: var(--os-accent);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s;
  text-decoration: none;
}

.navbar-back-button-container a:hover {
  color: var(--os-accent-hover);
}

/* ==================== BUTTONS ==================== */

.os-btn-primary,
.btn-primary,
.btn {
  display: inline-block;
  border-radius: var(--os-radius);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 24px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.os-btn-primary,
.btn-primary {
  background-color: var(--os-accent);
  color: #ffffff;
  box-shadow: var(--os-shadow-sm);
}

.os-btn-primary:hover,
.btn-primary:hover {
  background-color: var(--os-accent-hover);
  box-shadow: var(--os-shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
  color: #ffffff;
}

.btn-outline-secondary {
  color: var(--os-text-muted);
  border: 1px solid var(--os-border);
  background: transparent;
}

.btn-outline-secondary:hover {
  background-color: var(--os-bg-tertiary);
  border-color: var(--os-accent);
  color: var(--os-accent);
  text-decoration: none;
}

.btn-default {
  background-color: var(--os-bg-tertiary);
  color: var(--os-text-muted);
  border: 1px solid var(--os-border);
}

.btn-default:hover {
  background-color: var(--os-bg-alt);
  border-color: var(--os-text-muted);
  color: var(--os-text);
  text-decoration: none;
}

.btn-warning {
  background: var(--os-accent);
  color: #ffffff;
  border: none;
}

.btn-warning:hover {
  background: var(--os-accent-hover);
  color: #ffffff;
  text-decoration: none;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

/* Close button in modals */
.btn-close {
  background: transparent;
  border: none;
  color: var(--os-text);
  opacity: 0.7;
  cursor: pointer;
  font-size: 24px;
  padding: 0;
}

.btn-close:hover {
  opacity: 1;
}

/* ==================== CARDS & MATCH OVERVIEW ==================== */

.matchesOverview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
  width: 100%;
}

.matchOverviewLink {
  display: block;
  background: var(--os-bg-alt);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  padding: 20px;
  text-decoration: none;
  color: var(--os-text);
  box-shadow: var(--os-shadow-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.matchOverviewLink::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--os-accent), var(--os-accent-cool));
  opacity: 0;
  transition: opacity 0.3s;
}

.matchOverviewLink:hover {
  border-color: var(--os-accent);
  background: var(--os-accent-light);
  transform: translateY(-4px);
  box-shadow: var(--os-shadow-md);
  color: var(--os-text);
  text-decoration: none;
}

.matchOverviewLink:hover::before {
  opacity: 1;
}

.matchOverviewLink .matchDate {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--os-accent);
  margin-bottom: 12px;
  border: none;
  padding: 0;
}

.matchOverviewLink .playerNames {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.8;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--os-border);
  padding-bottom: 12px;
}

.matchOverviewLink .playerScores {
  font-family: 'Crimson Text', serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--os-accent-cool);
  text-align: right;
  line-height: 1.6;
}

/* ==================== SCORE TABLE ==================== */

.score-table {
  max-width: 460px;
  margin: 24px auto;
  background: var(--os-bg-alt);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  box-shadow: var(--os-shadow-md);
  overflow: hidden;
  padding: 0;
}

.score-table .player-score {
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--os-border);
}

.score-table .player-score:last-child {
  border-bottom: none;
}

.score-table .player-score .color {
  width: 4px;
  height: 100%;
  margin-right: 12px;
  flex-shrink: 0;
  border-radius: 2px;
}

.score-table .p1-score .color {
  background-color: var(--os-p1);
}

.score-table .p2-score .color {
  background-color: var(--os-p2);
}

.score-table .player {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--os-text);
}

.score-table .set {
  font-family: 'Crimson Text', serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--os-text-muted);
  text-align: center;
  width: 50px;
  margin: 0 4px;
}

.score-table .set.winner {
  color: var(--os-accent-cool);
}

/* Latest scores (history panel) */
.score-table-latest {
  margin-top: 12px;
  background: var(--os-bg-alt);
  border-radius: var(--os-radius);
  border: 1px solid var(--os-border);
  overflow: hidden;
  box-shadow: var(--os-shadow-sm);
}

.score-table-latest .player-score {
  height: 32px;
  font-size: 13px;
}

/* Progress bars */
.score-progress {
  height: 6px;
  margin: 0;
  border: none;
}

.p1-score-progress {
  background-color: var(--os-p1);
  border-radius: 2px;
}

.p2-score-progress {
  background-color: var(--os-p2);
  border-radius: 2px;
}

/* Score entry (admin page) */
.score-table-admin .set {
  cursor: pointer;
  border-radius: var(--os-radius-sm);
  transition: background-color 0.15s, color 0.15s;
}

.score-table-admin .set:hover {
  background-color: var(--os-bg-tertiary);
  color: var(--os-accent);
}

/* ==================== FORMS ==================== */

.form-label {
  color: var(--os-text);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.form-control,
input[type="text"],
input[type="email"],
select,
textarea {
  background-color: var(--os-bg-alt);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius-sm);
  color: var(--os-text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  background-color: var(--os-bg-alt);
  border-color: var(--os-accent);
  color: var(--os-text);
  box-shadow: 0 0 0 3px rgba(201, 113, 79, 0.1);
  outline: none;
}

.form-control::placeholder,
input::placeholder {
  color: var(--os-text-muted);
  opacity: 0.6;
}

.input-group-text {
  background-color: var(--os-bg-tertiary);
  border-color: var(--os-border);
  color: var(--os-text-muted);
}

.form-group,
.mb-3 {
  margin-bottom: 16px;
}

/* ==================== MODALS ==================== */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(26, 24, 19, 0.5);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-dialog {
  background: var(--os-bg-alt);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  max-width: 480px;
  width: 90%;
  box-shadow: var(--os-shadow-lg);
  position: relative;
}

.modal-content {
  background-color: var(--os-bg-alt);
  border: none;
  border-radius: var(--os-radius);
  color: var(--os-text);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--os-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 24px;
  color: var(--os-text);
}

.modal-body {
  padding: 20px 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--os-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-backdrop {
  display: none !important;
}

/* ==================== PANELS (Bootstrap 3 legacy) ==================== */

.panel {
  background: var(--os-bg-alt);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.panel-heading {
  padding: 8px 12px;
  background: var(--os-bg-tertiary);
  border-bottom: 1px solid var(--os-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--os-text-muted);
  font-weight: 600;
}

.panel-body {
  padding: 12px;
}

.panel-default {
  border-color: var(--os-border);
}

/* ==================== MAIN CONTAINER & SECTIONS ==================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  margin-top: 70px;
  margin-bottom: 80px;
}

.os-center-col {
  max-width: 460px;
  margin: 0 auto;
}

.os-section {
  margin-bottom: 48px;
}

.os-section-header {
  margin-bottom: 24px;
}

.os-section-title {
  font-size: 28px;
  margin-bottom: 4px;
}

.os-section-subtitle {
  font-size: 14px;
  color: var(--os-text-muted);
  margin: 0;
}

/* Hero section */
.os-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 60px;
  padding: 40px;
  background: linear-gradient(135deg, var(--os-bg-tertiary) 0%, transparent 100%);
  border-radius: var(--os-radius);
}

.os-hero h1 {
  line-height: 1.1;
  margin-bottom: 16px;
}

.os-hero p {
  font-size: 18px;
  color: var(--os-text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.os-hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.os-hero-visual {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

.os-showcase-card {
  background: var(--os-bg-alt);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  padding: 20px;
  width: 160px;
  box-shadow: var(--os-shadow-sm);
}

.os-showcase-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--os-accent);
  font-weight: 600;
  margin-bottom: 12px;
}

/* Load more button */
.os-load-more {
  text-align: center;
  margin-top: 24px;
}

.loadMoreMatches {
  display: inline-block;
  background: var(--os-bg-alt);
  border: 1px solid var(--os-border);
  border-radius: var(--os-radius);
  padding: 12px 20px;
  color: var(--os-text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 600;
}

.loadMoreMatches:hover {
  border-color: var(--os-accent);
  color: var(--os-accent);
  text-decoration: none;
}

/* ==================== ACTION BUTTONS ==================== */

.score-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.openAdminMatchButton,
.refreshButton,
.favorButton {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--os-text-muted);
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s;
  text-decoration: none;
}

.openAdminMatchButton:hover,
.refreshButton:hover,
.favorButton:hover {
  color: var(--os-accent);
  text-decoration: none;
}

/* ==================== MAIN HEADING ==================== */

#fitTextHeadline {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 32px;
  font-weight: 600;
  margin: 20px 0;
  text-align: center;
  word-wrap: break-word;
  color: var(--os-text);
  line-height: 1.2;
}

/* ==================== SOCIAL LINKS ==================== */

.social-links {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 16px 0;
  max-width: 450px;
  margin-left: auto;
  margin-right: auto;
}

.social-links .btn {
  flex: 1;
  padding: 10px;
  font-size: 12px;
}

/* ==================== BOTTOM NAVIGATION ==================== */

.os-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid var(--os-border);
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  z-index: 90;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.os-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--os-text-muted);
  text-decoration: none;
  cursor: pointer;
  padding: 4px 12px;
  transition: color 0.2s;
}

.os-nav-icon {
  font-size: 18px;
}

.os-nav-item:hover,
.os-nav-item.active {
  color: var(--os-accent);
  text-decoration: none;
}

.os-nav-item--new {
  background: var(--os-accent);
  color: #ffffff;
  border-radius: var(--os-radius);
  padding: 8px 20px;
  margin-top: -8px;
}

.os-nav-item--new:hover {
  background: var(--os-accent-hover);
  color: #ffffff;
  text-decoration: none;
}

/* Legacy bottomNav classes (compatibility) */
.bottomNavContainer {
  position: fixed;
  bottom: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.88);
  border-top: 1px solid var(--os-border);
  z-index: 90;
  padding-bottom: env(safe-area-inset-bottom);
}

.bottomNav {
  display: flex;
  height: 56px;
}

.bottomNavElement {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottomNavElement a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--os-text-muted);
  text-decoration: none;
  font-size: 11px;
  gap: 4px;
  transition: color 0.2s;
}

.bottomNavElement a i {
  font-size: 20px;
}

.bottomNavElement a.active {
  color: var(--os-accent);
}

/* ==================== UTILITIES ==================== */

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--os-text-muted) !important;
}

.text-danger {
  color: var(--os-accent) !important;
}

.d-grid {
  display: grid;
}

.gap-3 {
  gap: 16px;
}

.me-2 {
  margin-right: 8px;
}

.mb-3 {
  margin-bottom: 16px;
}

.mt-4 {
  margin-top: 24px;
}

.border-bottom {
  border-color: var(--os-border) !important;
}

.bg-white,
.bg-light {
  background-color: var(--os-bg-alt) !important;
}

/* Links */
a {
  color: var(--os-accent);
  text-decoration: none;
}

a:hover {
  color: var(--os-accent-hover);
  text-decoration: underline;
}

/* Full screen wrapper */
html.full {
  height: 100%;
}

html.full body {
  height: 100%;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .os-header-nav {
    gap: 16px;
  }

  .os-hero {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px;
    margin-bottom: 40px;
  }

  .os-hero-visual {
    justify-content: center;
  }

  .matchesOverview {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
  }

  .container {
    padding: 16px;
    margin-top: 60px;
  }

  #fitTextHeadline {
    font-size: 24px;
  }

  .score-table {
    max-width: 100%;
    margin: 16px;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .os-header-inner {
    padding: 0 16px;
  }

  .os-logo {
    font-size: 20px;
  }

  .os-header-nav {
    gap: 12px;
  }

  .matchesOverview {
    grid-template-columns: 1fr;
  }

  .os-hero {
    padding: 16px;
    gap: 16px;
  }

  .os-showcase-card {
    width: 120px;
    padding: 16px;
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 20px;
  }
}
