/* filepath: c:\Users\thomp\OneDrive\coc-stats\styles.css */
/* Clean, consistent design with proper typography, spacing, and card styling */

:root{
  --bg-0: #f6f8fb;
  --bg-1: #ffffff;
  --muted: #6b7280;
  --text: #0f172a;
  --accent: #2563eb;
  --accent-600: #1e40af;
  --card-shadow: 0 6px 24px rgba(16,24,40,0.06);
  --glass: rgba(255,255,255,0.6);
  --radius: 12px;
  --gap: 20px;
  --max-width: 1200px;
  --ui-pad: 18px;
}

/* Base */
* { box-sizing: border-box; }
html,body { height:100%; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  margin:0; padding:0;
  background: linear-gradient(180deg,var(--bg-0) 0%, #eef2f7 100%);
  color: var(--text);
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
  line-height:1.6;
  -webkit-text-size-adjust:100%;
}

/* Header styling */
header, .site-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:var(--gap);
  padding: calc(var(--ui-pad) * 0.9) calc(var(--ui-pad) * 1.2);
  background: linear-gradient(180deg,#0b1220 0%, #0f172a 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(2,6,23,0.12);
  position:sticky; top:0; z-index:80;
}
header .brand, .site-header .brand { 
  display:flex; 
  align-items:center; 
  gap:12px;
  position: relative;
  flex: 1;
}
header .logo, .site-header .logo { 
  height:32px; 
  width:auto; 
  display:block; 
}
header h1, .site-header h1 { 
  margin:0; 
  font-size:1.12rem; 
  font-weight:700; 
  letter-spacing:0.2px; 
}
header nav, .site-header nav, .main-nav { 
  display:flex; 
  gap:8px; 
  align-items:center; 
  margin-left:10px; 
}
header nav a, .site-header nav a, .main-nav a {
  color: rgba(255,255,255,0.9);
  text-decoration:none;
  padding:8px 10px;
  border-radius:8px;
  font-size:0.95rem;
  transition: all .12s ease;
  background: transparent;
}
header nav a:hover, .site-header nav a:hover, .main-nav a:hover { 
  background: rgba(255,255,255,0.04); 
  transform:translateY(-1px); 
}

/* Auth UI */
.auth-ui { 
  display:flex; 
  flex-direction:column; 
  align-items:flex-start; 
  gap:8px; 
}
.dropdown-container { 
  position: relative; 
  display: inline-block; 
}
.auth-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--bg-1);
  border: 1px solid rgba(15,23,42,0.12);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 320px;
  max-width: 360px;
  z-index: 90;
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.auth-panel.open { 
  display: flex; 
  animation: dropdownFade 140ms ease-out; 
}
@keyframes dropdownFade { 
  from { opacity: 0; transform: translateY(-6px); } 
  to { opacity: 1; transform: translateY(0); } 
}
.auth-panel .auth-title { 
  font-weight:700; 
  font-size:0.95rem; 
  color: var(--text); 
  margin-bottom: 8px; 
}
.auth-panel .auth-email-display { 
  font-size:0.9rem; 
  color: var(--muted); 
  margin-bottom: 8px; 
  padding-bottom: 8px; 
  border-bottom: 1px solid rgba(15,23,42,0.08); 
}
.auth-panel .auth-user { 
  margin-top:6px; 
  font-size:0.9rem; 
  color:var(--text); 
}

/* Main content area */
main {
  padding: 3rem 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
  width:100%;
}

/* Cards & containers */
.table-container, .card, .history-entry, .summary-card {
  background: var(--bg-1);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(15,23,42,0.06);
}

/* Typography */
h1, h2, h3 { color: var(--text); line-height: 1.3; }
h2 { font-size: 1.5rem; margin: 0 0 20px 0; }
h3 { font-size: 1.2rem; margin: 0 0 16px 0; }
p { margin: 0 0 16px 0; }

/* Tables */
table {
  width:100%; 
  border-collapse:collapse; 
  font-size:0.95rem;
  background: transparent;
  border-radius:8px; 
  overflow:hidden;
}
th, td {
  padding:14px 16px; 
  text-align:left;
  border-bottom: 1px solid rgba(15,23,42,0.06);
}
th {
  background: linear-gradient(180deg,#f8fafc,#eef2ff);
  font-weight:700; 
  color:var(--text);
  font-size:0.92rem;
}
tr:nth-child(even) td { 
  background: #fbfdff; 
}

/* Form inputs */
input[type="text"], input[type="email"], input[type="number"], select, textarea {
  padding:8px 10px; 
  border-radius:8px; 
  border:1px solid rgba(15,23,42,0.08);
  background: #fff; 
  color:var(--text); 
  outline:none; 
  font-size:0.95rem;
  transition: box-shadow .12s ease, border-color .12s ease;
}
input:focus, select:focus, textarea:focus { 
  border-color: #60a5fa; 
  box-shadow: 0 0 0 6px rgba(96,165,250,0.08); 
}

/* Buttons */
button {
  display:inline-flex; 
  align-items:center; 
  gap:8px;
  padding:10px 16px; 
  border-radius:10px; 
  border:0;
  background: linear-gradient(180deg,var(--accent),var(--accent-600));
  color: #fff; 
  font-weight:700; 
  cursor:pointer;
  box-shadow: 0 8px 20px rgba(37,99,235,0.12);
  transition: transform .08s ease, box-shadow .08s ease, opacity .12s;
  font-size:0.95rem;
}
button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37,99,235,0.2);
}
button:active { 
  transform: translateY(1px); 
}
button.secondary {
  background: linear-gradient(180deg,#f1f5f9,#e6eefc); 
  color:var(--text); 
  box-shadow:none; 
  border:1px solid rgba(15,23,42,0.08);
}
button.secondary:hover {
  background: linear-gradient(180deg,#e6eefc,#dae3f4);
  box-shadow: 0 4px 12px rgba(15,23,42,0.08);
}
button.small { 
  padding:8px 10px; 
  font-size:0.88rem; 
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.12);
}

/* Toolbar */
.toolbar {
  display:flex;
  justify-content:space-between;
  gap:32px;
  align-items:center;
  margin-bottom:36px;
}

/* History items and spacing */
.history-item, #history-list .history-entry {
  margin-top: 28px;
  margin-bottom: 36px;
  padding-top: 28px;
  padding-bottom: 50px;
  padding-left: 24px;
  padding-right: 24px;
  border-radius: 16px;
  transition: transform .08s ease, box-shadow .08s ease;
}
.history-item:hover { 
  transform: translateY(-6px); 
  box-shadow: 0 16px 48px rgba(2,6,23,0.10);
}

.history-day-meta { 
  display:flex; 
  justify-content:space-between; 
  gap:20px; 
  align-items:flex-start; 
  padding-top: 12px;
  padding-bottom: 16px;
}
.history-meta-left > .muted {
  margin-top: 8px;
  margin-bottom: 8px;
}
.history-meta-right {
  display:flex;
  gap:8px;
  align-items:center;
}

/* Day grid layout */
.day-grid {
  display:grid; 
  grid-template-columns: 1fr 1fr; 
  gap:32px;
  margin-top:22px;
}
@media (max-width:880px) { 
  .day-grid { 
    grid-template-columns: 1fr; 
    gap: 20px; 
    margin-top: 18px; 
  } 
}

/* Entry tables */
.entry-table-wrap { 
  overflow-x:auto; 
  max-width:100%; 
  padding-bottom:8px; 
}
.entry-table { 
  width:100%; 
  min-width:380px; 
  border-collapse:collapse; 
}
.entry-table th, .entry-table td { 
  padding:14px 16px;
  font-size:0.98rem;
  white-space:nowrap;
}
.entry-table td input { 
  width:100%; 
  box-sizing:border-box; 
  padding:8px; 
  border-radius:8px; 
  border:1px solid rgba(15,23,42,0.06); 
}
.entry-empty { 
  padding:10px; 
  color:var(--muted); 
  font-style:italic; 
}

/* Season badge */
.season-day { 
  background: #eef2ff; 
  color: #1e3a8a; 
  padding:10px 14px;
  border-radius:999px; 
  font-weight:700; 
  font-size:1rem; 
  margin-left:14px;
}

/* Net trophy badge */
.net-badge {
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  font-weight:700;
  font-size:0.95rem;
  margin-left:10px;
  box-shadow: 0 6px 18px rgba(2,6,23,0.06);
  transition: transform .12s ease, box-shadow .12s ease;
}
.net-badge.net-positive {
  background: linear-gradient(180deg,#ecfdf5,#bbf7d0);
  color: #065f46;
  border: 1px solid rgba(16,185,129,0.12);
}
.net-badge.net-negative {
  background: linear-gradient(180deg,#fff1f2,#fecaca);
  color: #7f1d1d;
  border: 1px solid rgba(239,68,68,0.12);
}
.net-badge.net-neutral {
  background: linear-gradient(180deg,#f8fafc,#eef2ff);
  color: #0f172a;
  border: 1px solid rgba(15,23,42,0.04);
}
.net-badge:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 12px 30px rgba(2,6,23,0.08); 
}

/* Status messages */
.save-status, #save-status { 
  color: #059669; 
  font-weight:700; 
  margin-left:8px; 
}
#save-confirmation { 
  transition: opacity .18s ease, transform .18s ease; 
}

/* Utility classes */
.muted { 
  color:var(--muted); 
  font-size:0.95rem; 
}
.kv { 
  display:flex; 
  gap:8px; 
  align-items:center; 
}
.center { 
  text-align:center; 
}

/* Footer */
footer { 
  margin-top:24px; 
  padding:1rem; 
  text-align:center; 
  color:var(--muted); 
}

/* Accessibility */
:focus { 
  outline: none; 
}
:focus-visible { 
  outline: 3px solid rgba(37,99,235,0.18); 
  border-radius:6px; 
}

/* Responsive design */
@media (max-width:520px) {
  header, .site-header { 
    padding: 10px 12px; 
  }
  header h1, .site-header h1 { 
    font-size:1rem; 
  }
  main { 
    padding: 1.25rem; 
  }
  .toolbar { 
    flex-direction:column; 
    align-items:flex-start; 
    gap:10px; 
  }
  .muted { 
    font-size:0.9rem; 
  }
  .day-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .entry-table { 
    min-width: 320px; 
  }
  .card {
    padding: 16px;
  }
}

@media (max-width:880px) {
  main { 
    padding: 1.6rem 1rem; 
  }
}

/* Add-row button style */
.history-add-row-btn { 
  background: linear-gradient(180deg,#f1f5f9,#e6eefc); 
  color:var(--text); 
  border:1px solid rgba(15,23,42,0.04); 
}
.history-add-row-btn:hover {
  background: linear-gradient(180deg,#e6eefc,#dae3f4);
  box-shadow: 0 4px 12px rgba(15,23,42,0.08);
}
.history-add-row-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.12);
}

/* History shell wrapper */
.history-shell {
  padding: 3rem 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
  width:100%;
}

/* Summary card styling */
#history-summary {
  display: flex;
  gap: 24px;
  margin-bottom: 28px;
  align-items: center;
  flex-wrap: wrap;
}

/* Ensure history items don't wrap text awkwardly */
.history-item { 
  overflow-wrap: break-word; 
  word-break: break-word; 
}

/* Drag and Drop Styling for Editable Tables */
.entry-table.editable tbody tr {
  transition: opacity 0.2s, background-color 0.15s;
}

.entry-table.editable tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.04);
}

.entry-table.editable tbody tr.drag-over {
  background-color: rgba(59, 130, 246, 0.12);
}

/* Drag Handle Styling */
td.drag-handle, th.drag-handle {
  cursor: grab;
  padding: 8px 4px !important;
  width: 24px;
  min-width: 24px;
  text-align: center;
  color: #d1d5db;
  font-size: 0.9rem;
  font-weight: bold;
  user-select: none;
  transition: color 0.2s, background-color 0.15s;
}

td.drag-handle:hover {
  color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.1);
}

td.drag-handle:active {
  cursor: grabbing;
  color: #1e40af;
}

th.drag-handle {
  background-color: transparent;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  box-shadow: none;
}

.mobile-menu-toggle span {
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(10px, 10px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }

  header .brand, .site-header .brand {
    width: 100%;
    justify-content: space-between;
  }

  .main-nav {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: #0b1220;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 12px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 100;
  }

  .main-nav.mobile-open {
    display: flex !important;
  }

  .main-nav a {
    padding: 12px 16px;
    border-radius: 0;
    display: block;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }

  .main-nav a:last-child {
    border-bottom: none;
  }
}

/* Auth Modal */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.auth-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9997;
}

.auth-modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  z-index: 9998;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 28px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #0f172a;
  transform: none;
  box-shadow: none;
}

.auth-modal-content form h2 {
  margin: 0 0 20px 0;
  font-size: 1.5rem;
  color: #0f172a;
}

.auth-modal-content form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.95rem;
  color: #0f172a;
  box-sizing: border-box;
}

.auth-modal-content form input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  outline: none;
}

.auth-modal-content form button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  min-height: 40px;
  width: 100%;
}/* Remember me checkbox - hide on mobile */
@media (max-width: 768px) {
  #remember-me-container {
    display: none !important;
  }
}

/* Input validation feedback */
.form-error {
  border-color: #dc2626 !important;
  background: rgba(220,38,38,0.02);
}

/* Password strength indicator animations */
#strength-1, #strength-2, #strength-3, #strength-4 {
  transition: background-color 0.2s ease;
}

/* Empty state styling */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state-message {
  font-size: 1.05rem;
  margin: 0;
}
