/* ===== app/static/style.css - Dark theme ===== */

/* ========== CSS Variables ========== */
:root {
  --bg: #0b0f13;
  --panel: #0f1720;
  --muted: #9aa5b1;
  --text: #e6eef6;
  --accent: #40a9ff;
  --accent-2: #7bd389;
  --danger: #ff6b6b;
  --table-border: rgba(255,255,255,0.06);
  --glass: rgba(255,255,255,0.03);
  --radius: 8px;
}

/* ========== Global Styles ========== */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: linear-gradient(180deg, var(--bg), #071018 120%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.45;
  font-size: 16px;
}

/* ========== Layout ========== */
header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--table-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
}

main {
  max-width: 1100px;
  margin: 24px auto;
  padding: 20px;
}

footer {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 16px;
}

/* ========== Typography ========== */
h1, h2, h3 {
  color: var(--text);
  margin: 0 0 12px 0;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 16px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ========== Components ========== */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
  border: 1px solid var(--table-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 6px 18px rgba(2,8,23,0.5);
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--bg);
  background: var(--accent);
  font-weight: 600;
}

.badge-off {
  background: #4b5563 !important;
  color: #e5e7eb !important;
}

.badge-sem {
  box-shadow: 0 0 0 2px rgba(250, 250, 210, 0.7);
}

.badge-ob5 {
  background: var(--danger);
  color: var(--bg);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
  margin-left: 8px;
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

button, .btn {
  background: var(--accent);
  color: var(--bg);
  border: 0;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

button.secondary, .btn.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--table-border);
}

input, select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--table-border);
  padding: 8px 10px;
  border-radius: 6px;
}

/* ========== Tables ========== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.95rem;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--table-border);
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
  color: var(--text);
}

tr:hover td {
  background: rgba(255,255,255,0.01);
}

td.num, th.num {
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Sticky tables */
.table-sticky {
  border-collapse: separate;
  border-spacing: 0;
}

.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--panel);
}

.table-sticky .sticky-col {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--panel);
}

/* Today row highlight */
.today-row {
  background: rgba(64, 169, 255, 0.08);
}

.today-row:hover {
  background: rgba(64, 169, 255, 0.14);
}

/* ========== Navigation ========== */
.nav-link {
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
  border: 1px solid transparent;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(255,255,255,0.03);
}

/* Hamburger menu - hidden on desktop */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 100;
}

.hamburger span {
  width: 30px;
  height: 3px;
  background: var(--text);
  border-radius: 3px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-11px) rotate(-45deg);
}

/* ========== Page Headers ========== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.page-header-left,
.page-header-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-title {
  margin: 10px 0 18px 0;
  font-size: 20px;
}

/* ========== Day View ========== */
.day-header {
  margin-top: 12px;
  margin-bottom: 18px;
}

.day-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.4fr);
  gap: 24px;
  margin-top: 16px;
}

.day-section h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.day-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.day-button-row .btn {
  margin: 0;
}

.day-button-row.person-select {
  margin-top: 10px;
}

.day-button-row nav-btns {
  margin-top: 4px;
}

.day-buttons-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.day-buttons-left,
.day-buttons-right {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-person {
  padding: 5px 9px;
  font-size: 0.8rem;
  border-radius: 999px;
}

.btn-person-active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ========== Utility Classes ========== */
.row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.col {
  flex: 1;
}

/* ========== Responsive / Media Queries ========== */

/* Tablet and below */
@media (max-width: 900px) {
  .day-layout {
    grid-template-columns: 1fr;
  }
}

/* Mobile landscape and below */
@media (max-width: 800px) {
  main {
    padding: 12px;
  }

  /* Show hamburger on mobile */
  .hamburger {
    display: flex;
  }

  /* Hide navigation by default on mobile */
  .main-nav {
    position: fixed;
    top: 60px;
    right: -100%;
    width: 160px;
    height: auto;
    flex-direction: column;
    background: var(--panel);
    border-left: 1px solid var(--table-border);
    padding: 4px;
    transition: right 0.3s ease;
    z-index: 99;
    gap: 0 !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
  }

  /* Show navigation when active */
  .main-nav.active {
    right: 0;
  }

  /* Navigation links in mobile menu */
  .main-nav .nav-link {
    width: 100%;
    padding: 8px 12px !important;
    margin: 0 !important;
    display: block;
    font-size: 0.95rem;
    line-height: 1.2;
    border: none !important;
    outline: none !important;
    min-height: auto;
    height: auto !important;
  }

  /* Adjust header layout */
  header .row {
    justify-content: space-between;
    align-items: center;
  }

  button, .btn {
    padding: 10px 16px;
    font-size: 0.95rem;
  }

  /* Better card spacing */
  .card {
    padding: 12px;
    margin-bottom: 16px;
  }

  /* Improve form inputs for mobile */
  input, select {
    padding: 10px 12px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Tables: responsive mode */
  thead {
    display: none;
  }

  tbody td {
    display: block;
    width: 100%;
    padding: 8px 12px;
  }

  tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    display: inline-block;
    margin-right: 8px;
  }

  tbody tr {
    margin: 8px 0;
    display: block;
    border-bottom: 1px solid var(--table-border);
    background: var(--panel);
    border-radius: var(--radius);
    padding: 8px;
  }

  /* Page headers stack on mobile */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .page-header-left,
  .page-header-right {
    width: 100%;
  }

  /* Title adjustments */
  h1 {
    font-size: 20px;
  }

  h2, .page-title {
    font-size: 18px;
  }

  h3 {
    font-size: 15px;
  }

  /* Year view: reorder on mobile */
  .year-layout {
    flex-direction: column;
  }

  .year-cowork {
    order: 2; /* CoWork stats after monthly summary */
    min-width: 100% !important;
  }

  .year-summary {
    order: 1; /* Monthly summary first */
    min-width: 100% !important;
  }
}

/* Mobile portrait */
@media (max-width: 700px) {
  .day-buttons-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Full width buttons on small screens */
  .page-header-left .btn,
  .page-header-right .btn {
    flex: 1;
  }

  /* Better badge sizing */
  .badge {
    font-size: 0.75rem;
    padding: 3px 7px;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  header {
    padding: 12px 16px;
  }

  main {
    padding: 8px;
  }

  /* Navigation takes full width */
  nav.row {
    flex-wrap: wrap;
  }

  .nav-link {
    flex: 1 1 auto;
    text-align: center;
    min-width: 80px;
  }

  /* Override flex behavior for hamburger menu links */
  .main-nav .nav-link {
    flex: 0 0 auto !important;
  }

  /* Smaller badges on tiny screens */
  .badge {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  /* Adjust table font size */
  table {
    font-size: 0.88rem;
  }

  tbody td {
    padding: 6px 10px;
  }
}

/* Overtime Form Styles */
.ot-form .form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ot-form .form-group {
    flex: 1;
}

.ot-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.ot-form input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.ot-display {
    margin-top: 1rem;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.btn-danger:hover {
    background-color: #c82333;
}

.info-text {
    font-size: 0.9em;
    color: #666;
    margin-top: 0.5rem;
    font-style: italic;
}
