/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e5e7eb;
  min-height: 100vh;
}

/* Hintergrund */
.bg {
  background: radial-gradient(circle at top, #1f2937, #020617 60%);
  position: relative;
}

.overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.12), transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.08), transparent 55%);
  pointer-events: none;
  z-index: -1;
}

/* Layout */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 3rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.logo span {
  color: #3b82f6;
}

.nav a,
.link-button {
  margin-left: 1.5rem;
  text-decoration: none;
  color: #9ca3af;
  font-size: 0.95rem;
  border: none;
  background: none;
  cursor: pointer;
}
.nav a:hover,
.link-button:hover {
  color: #e5e7eb;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr);
  gap: 2.5rem;
  padding: 2rem 3rem 4rem;
}

.portal-main {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* Intro (nur auf index.html benutzt, schadet hier aber nicht) */
.intro h1 {
  font-size: 2.4rem;
  margin-bottom: 1rem;
}
.intro p {
  margin-bottom: 1rem;
  color: #9ca3af;
}
.intro ul {
  list-style: none;
}
.intro li {
  margin-bottom: 0.35rem;
  color: #d1d5db;
}

/* Karten */
.card {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 1.25rem;
  padding: 1.75rem 1.75rem 1.5rem;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(14px);
}

.card h2,
.card h1 {
  margin-bottom: 1rem;
}

/* Login-Karte (für index.html) */
.login-card {
  max-width: 380px;
  justify-self: center;
}

/* Formulare */
form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

label {
  font-size: 0.85rem;
  color: #d1d5db;
}

input {
  border-radius: 0.7rem;
  border: 1px solid #4b5563;
  padding: 0.55rem 0.7rem;
  background: rgba(15, 23, 42, 0.9);
  color: #f9fafb;
}
input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
}

/* Buttons */
button[type="submit"],
button[type="button"],
button:not(.link-button) {
  margin-top: 0.5rem;
  border-radius: 999px;
  border: none;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, #2563eb, #22c55e);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.5);
}
button:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

/* Zeiterfassung */
.time-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.time-form .full-width {
  grid-column: 1 / -1;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Liste der Einträge */
.time-list {
  margin-top: 0.75rem;
  max-height: 320px;
  overflow-y: auto;
  font-size: 0.9rem;
}
.time-entry {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid rgba(55, 65, 81, 0.7);
}
.time-entry:last-child {
  border-bottom: none;
}
.time-entry-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}
.time-entry-time {
  font-weight: 600;
}
.time-entry-date {
  font-size: 0.75rem;
  color: #9ca3af;
}
.time-entry-desc {
  color: #e5e7eb;
}
.empty-state {
  color: #9ca3af;
  font-style: italic;
}

/* Timer-Bereich */
.timer-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(55, 65, 81, 0.7);
}

.timer-section h3 {
  margin-bottom: 0.5rem;
}

.timer-display {
  font-family: monospace;
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* Filter / "Kalender"-Ansicht */
.time-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: #d1d5db;
}

.time-filter input[type="date"] {
  max-width: 170px;
  border-radius: 0.5rem;
  border: 1px solid #4b5563;
  padding: 0.3rem 0.5rem;
  background: rgba(15, 23, 42, 0.9);
  color: #f9fafb;
}

.time-filter input[type="date"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.4);
}

.time-date-header {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #9ca3af;
  border-bottom: 1px solid rgba(55, 65, 81, 0.9);
  padding-bottom: 0.15rem;
}

/* Sonstiges */
.hint {
  font-size: 0.8rem;
  color: #9ca3af;
}
.message {
  font-size: 0.85rem;
  margin-top: 0.25rem;
}
.message.error {
  color: #f87171;
}
.message.success {
  color: #4ade80;
}

/* Footer */
.footer {
  position: fixed;
  right: 1.5rem;
  bottom: 1rem;
  font-size: 0.85rem;
}
.footer a {
  color: #9ca3af;
  text-decoration: none;
}
.footer a:hover {
  color: #e5e7eb;
}

/* Impressum-Seite */
.impressum-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* Responsive */
@media (max-width: 900px) {
  .main {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }
  .header {
    padding: 1rem 1.5rem;
  }
  .login-card {
    max-width: 100%;
  }
}

/* ===== Portal Layout ===== */
.portal-grid{
  display:grid;
  grid-template-columns: 360px minmax(420px, 1fr) 420px;
  gap: 1.25rem;
  padding: 1.25rem 2rem 4rem;
}

@media (max-width: 1200px){
  .portal-grid{ grid-template-columns: 1fr; }
}

/* ===== Form ===== */
.form-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:.75rem 1rem;
}
.form-grid .full{ grid-column: 1 / -1; }

select{
  border-radius: .7rem;
  border: 1px solid #4b5563;
  padding: .55rem .7rem;
  background: rgba(15, 23, 42, 0.9);
  color: #f9fafb;
}
select:focus{
  outline:none;
  border-color:#3b82f6;
  box-shadow: 0 0 0 1px rgba(59,130,246,.4);
}

.primary{
  border-radius: 999px;
  border: none;
  padding: .65rem 1rem;
  background: linear-gradient(135deg, #2563eb, #22c55e);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

.divider{
  height: 1px;
  background: rgba(55, 65, 81, 0.8);
  margin: 1rem 0;
}

.subhead{ margin: 0.25rem 0 0.5rem; }

/* ===== Day view ===== */
.summary{
  margin: .5rem 0 .75rem;
  padding: .6rem .75rem;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: .9rem;
  background: rgba(15,23,42,.55);
  color: #e5e7eb;
}

.entry-row{
  display:flex;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem .75rem;
  border: 1px solid rgba(148,163,184,.14);
  border-radius: .95rem;
  background: rgba(15,23,42,.55);
  margin-bottom: .6rem;
}
.entry-top{
  display:flex;
  gap:.5rem;
  align-items:center;
  justify-content: space-between;
}
.entry-time{ font-weight: 800; }
.entry-pill{
  font-size: .72rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.25);
  color: #d1d5db;
}
.entry-meta{
  margin-top: .25rem;
  color: #9ca3af;
  font-size: .85rem;
}
.entry-desc{
  margin-top: .35rem;
  color: #e5e7eb;
}
.entry-actions{
  display:flex;
  flex-direction: column;
  gap: .4rem;
  align-items:flex-end;
}
.mini{
  font-size: .75rem;
  padding: .35rem .6rem;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.35);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  cursor:pointer;
}
.mini.danger{
  border-color: rgba(248,113,113,.7);
}

/* ===== Kalender: Überlappung/Skalierung Fix ===== */
.calendar-card { 
  overflow: hidden; 
}

/* Wichtig: minmax(0, 1fr) verhindert Overflow/Überlappen in CSS-Grids */
.year-calendar{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

/* Responsive: 2 Spalten / 1 Spalte */
@media (max-width: 1200px){
  .year-calendar{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px){
  .year-calendar{ grid-template-columns: 1fr; }
}

/* Month-Card darf NICHT breiter als ihre Grid-Zelle werden */
.month-box{
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* Das innere Grid darf auch nicht "sprengen" */
.month-grid{
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .25rem;
}

/* Buttons dürfen nicht durch padding/border zu breit werden */
.day{
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;      /* macht die Tage sauber quadratisch */
  padding: 0;               /* padding raus, sonst werden sie zu groß */
  display: grid;
  place-items: center;
}

/* Optional: etwas kleinere Tage auf kleineren Screens */
@media (max-width: 1400px){
  .day{ font-size: .72rem; }
}


.month-box{
  border: 1px solid rgba(148,163,184,.14);
  border-radius: 1rem;
  background: rgba(15,23,42,.55);
  padding: .75rem;
}
.month-title{
  font-weight: 800;
  letter-spacing: .08em;
  color:#9ca3af;
  margin-bottom: .5rem;
  font-size: .85rem;
}

.month-grid{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap: .25rem;
}
.dow{
  text-align:center;
  font-size: .7rem;
  color:#9ca3af;
  padding: .15rem 0 .25rem;
}

.day{
  border-radius: .55rem;
  border: 1px solid rgba(148,163,184,.10);
  background: rgba(2,6,23,.35);
  color: #e5e7eb;
  padding: .35rem 0;
  cursor:pointer;
  font-size: .75rem;
}
.day.pad{
  border:none;
  background: transparent;
  cursor: default;
}
.day:hover{
  border-color: rgba(59,130,246,.35);
}
.day.today{
  border-color: rgba(34,197,94,.55);
}
.day.selected{
  outline: 2px solid rgba(59,130,246,.55);
}
.day.hasEntries{
  position: relative;
}
.day.hasEntries::after{
  content:"";
  position:absolute;
  left:50%;
  transform: translateX(-50%);
  bottom: 4px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(34,197,94,.9);
}

/* Month tools */
.day-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: .75rem;
}
.day-tools, .month-tools{
  display:flex;
  gap:.5rem;
  align-items:center;
}

/* Report table */
.report-table-wrapper{
  max-height: 280px;
  overflow: auto;
  border-radius: .9rem;
  border: 1px solid rgba(55,65,81,.7);
}
.report-table{
  width:100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.report-table th, .report-table td{
  padding: .4rem .6rem;
  border-bottom: 1px solid rgba(55,65,81,.7);
}
.report-table th{
  position: sticky;
  top: 0;
  background: rgba(15,23,42,.95);
  text-align:left;
}
/* ===== Monatskalender (mittig) ===== */
.month-calendar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: .5rem 0 .25rem;
}

.month-grid-large {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .5rem;
}

.dow-large {
  text-align: center;
  font-size: .85rem;
  color: #9ca3af;
  padding-bottom: .25rem;
}

.day-large {
  border-radius: 1rem;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.35);
  color: #e5e7eb;
  height: 52px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-weight: 700;
  transition: transform .08s ease, border-color .12s ease, background .12s ease;
}

.day-large:hover {
  transform: translateY(-1px);
  border-color: rgba(59,130,246,.45);
}

.day-large.pad {
  border: none;
  background: transparent;
  cursor: default;
}

.day-large.today {
  border-color: rgba(59,130,246,.75);
}

/* ausgewählter Tag */
.day-large.selected {
  outline: 2px solid rgba(59,130,246,.55);
}

/* ===== Status-Farben ===== */
/* Grau = keine Einträge */
.day-large.empty {
  background: rgba(148,163,184,.12);
  color: rgba(229,231,235,.85);
  border-color: rgba(148,163,184,.18);
}

/* Grün = Einträge vorhanden */
.day-large.hasEntries {
  background: linear-gradient(135deg, rgba(34,197,94,.95), rgba(37,99,235,.85));
  border-color: rgba(34,197,94,.55);
  color: white;
}
