/* assets/css/common.css */

:root {
  --background: #2c2d31;
  --background-secondary: #36393f;
  --background-tertiary: #202225;
  --text-primary: #dcddde;
  --text-secondary: #b9bbbe;
  --text-muted: #72767d;
  --blurple: #5865f2;
  --red: #ed4245;
  --green: #3ba55c;
  --yellow: #faa61a;
  --nav-height: 60px;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  padding-top: var(--nav-height);
}

/* Common layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  transition: margin-left 0.25s ease, width 0.25s ease, max-width 0.25s ease;
}

h1, h2, h3, h4 {
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Card component */
.card {
  background-color: var(--background-secondary);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Grid layouts */
.grid {
  display: grid;
  gap: 1.5rem;
}
.grid-2 {
  grid-template-columns: 1fr;
}
@media(min-width:768px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* Form elements */
input[type="number"],
select {
  background-color: #4f545c;
  color: var(--text-primary);
  border: none;
  padding: 0.5rem;
  border-radius: 4px;
  width: 100%;
  margin-bottom: 1rem;
}

button {
  background-color: var(--blurple);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
}
button:hover {
  background-color: #4752c4;
}
button:disabled {
  background-color: var(--text-muted);
  cursor: not-allowed;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 1rem;
}

.error {
  color: var(--red);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 0.5rem;
  border: 1px solid #555;
}
th {
  background-color: var(--background-tertiary);
}
tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Chart container */
.chart-container {
  position: relative;
  height: 350px;
  width: 100%;
}

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

/* Checkbox container */
.checkbox-container {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}
.checkbox-container input {
  margin-right: 0.5rem;
  accent-color: var(--blurple);
}

/* Percentile cards */
.percentile-card {
  padding: 1rem;
  border-radius: 4px;
  border-width: 2px;
  border-style: solid;
  margin-bottom: 1rem;
}
.percentile-card.unlucky {
  background-color: rgba(237,66,69,0.1);
  border-color: var(--red);
}
.percentile-card.average {
  background-color: rgba(250,166,26,0.1);
  border-color: var(--yellow);
}
.percentile-card.lucky {
  background-color: rgba(59,165,92,0.1);
  border-color: var(--green);
}

/* Navigation Bar Styles */
.navbar {
  background-color: var(--background-tertiary);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-secondary);
  text-decoration: none;
  flex: 0 1 auto;
  min-width: 0;
}

.navbar-page-title {
  color: var(--text-primary);
  font-size: clamp(0.95rem, 3.5vw, 1.2rem);
  font-weight: 700;
  line-height: 1.2;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.menu-button {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  display: block;
  padding: 0.5rem;
  margin-left: -0.25rem;
  flex: 0 0 auto;
}

.nav-menu {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  background-color: var(--background-secondary);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  width: var(--sidebar-width);
  height: calc(100vh - var(--nav-height));
  padding-top: 0;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 200;
  overflow-y: auto;
}

.nav-menu.active {
  transform: translateX(0);
}

.nav-menu ul {
  list-style: none;
  padding: 0;
}

.nav-menu li {
  border-bottom: 1px solid var(--background-tertiary);
}

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

.nav-menu a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.2s;
}

.nav-menu a:hover {
  background-color: var(--background-tertiary);
  color: var(--blurple);
}

@media (min-width: 768px) {
  .navbar {
    padding: 0.5rem 2rem;
  }

  body.nav-open:not(.content-compact) .container {
    --open-container-width: min(1200px, calc(100vw - 2rem), calc(100vw - var(--sidebar-width) - 2rem));
    width: var(--open-container-width);
    max-width: none;
    margin-left: max(calc((100vw - var(--open-container-width)) / 2), calc(var(--sidebar-width) + 1rem));
    margin-right: auto;
  }

  body.nav-open.content-compact:not(.nav-overlay) .container {
    width: calc(100vw - var(--sidebar-width));
    max-width: none;
    min-width: 0;
    margin-left: var(--sidebar-width);
    margin-right: 0;
  }
  
  /* Optional: Hide hamburger and show navigation items in a horizontal menu on larger screens */
  /*
  .menu-button {
    display: none;
  }
  
  .nav-menu {
    display: block;
    position: static;
    background: none;
    box-shadow: none;
    width: auto;
  }
  
  .nav-menu ul {
    display: flex;
  }
  
  .nav-menu li {
    border: none;
    margin-left: 1.5rem;
  }
  
  .nav-menu a {
    padding: 0;
  }
  
  .nav-menu a:hover {
    background: none;
  }
  */
}

@media (max-width: 767px) {
  body.nav-open {
    overflow: hidden;
  }

  .container {
    max-width: none;
    width: 100%;
    padding: 0;
  }

  .card {
    border-radius: 0;
    margin-bottom: 1rem;
    padding: 1.25rem 1rem;
    box-shadow: none;
  }

  .nav-menu {
    width: 100vw;
    height: calc(100vh - var(--nav-height));
  }
}

body.content-compact .container {
  max-width: none;
  width: 100%;
  padding: 0;
}

body.content-compact .card {
  border-radius: 0;
  margin-bottom: 1rem;
  padding: 1.25rem 1rem;
  box-shadow: none;
}

body.nav-overlay.nav-open {
  overflow: hidden;
}

body.nav-overlay .nav-menu {
  width: 100vw;
  height: calc(100vh - var(--nav-height));
}

/* Add margin to the content to account for fixed navbar if needed */
/*
body {
  padding-top: 60px;
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}
*/
