/* =========================================================
   0. VÄRIPALETTI & MUUT PERUSMUUTTUJAT
   ========================================================= */
:root {
    --radius: 10px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.25);

    /* Tumma paletti */
    --bg: #111215;
    --surface: #1c1e22;
    --surface-alt: #24262b;
    --text: #eaecee;
    --muted: #9ba1ac;
    --accent: #7ec4ff;
    --accent-hover: #aad8ff;
}

/* =========================================================
   1. RESET & TYPOGRAPHY
   ========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", system-ui, sans-serif;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Pieni helper monospace-fontille – käytä <code>…</code> kun tarvetta */
code {
    font-family: ui-monospace, "SF Mono", monospace;
}

/* =========================================================
   2. RAKENNE & LAYOUT
   ========================================================= */
header {
    background: var(--surface);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

header h1 {
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.5px;
    font-size: clamp(1.3rem, 1.3rem + 1vw, 1.8rem);
}

main {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    padding: 1.5rem 1.8rem;
}

@media (max-width: 800px) {
    main {
        grid-template-columns: 1fr;
    }

    #task-manager {
        order: 2;
    }
}

/* =========================================================
   3. SIVUPANEELI (TASK MANAGER)
   ========================================================= */
#task-manager {
    background: var(--surface);
    padding: 1.2rem 1rem;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: var(--shadow);
    position: sticky;
    /* pysyy näkyvissä skrollatessa */
    top: 1.5rem;
}

#task-manager h2 {
    margin: 0 0 0.3rem 0;
    font-size: 1.15rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

input[type="text"],
input[name$="-name"] {
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius);
    border: 1px solid var(--surface-alt);
    background: var(--surface-alt);
    color: var(--text);
}

input::placeholder {
    color: var(--muted);
}

button {
    padding: 0.55rem;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: #000;
    font-weight: 500;
    cursor: pointer;
    transition: background 120ms, transform 120ms;
}

button:hover {
    background: var(--accent-hover);
}

button:active {
    transform: translateY(1px);
}

#task-manager ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

#task-manager li {
    background: var(--surface-alt);
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.delete-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 120ms;
}

.delete-btn:hover {
    color: var(--accent-hover);
}

/* =========================================================
   4. VIIKKONÄKYMÄ
   ========================================================= */
#week-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 1.5rem;
}

.day-col {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 0.9rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: transform 160ms;
}

.day-col.no-tasks {
    background: var(--surface-alt);
    opacity: 0.7;
    position: relative;
}

.day-col.no-tasks::after {
    content: "Ei tehtäviä";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--muted);
    font-size: 0.9rem;
    font-style: italic;
}

.day-col.no-tasks h3 {
    color: var(--muted);
}

.day-col.no-tasks ul {
    display: none;
}

.day-col:hover {
    transform: translateY(-2px);
}

.day-col h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--accent-hover);
}

.day-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.day-col li {
    font-size: 0.9rem;
}

/* =========================================================
   5. TEHTÄVÄ-ITEMIT
   ========================================================= */
/* Päivittäiset (ei vedettävät) */
.day-col li label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Viikoittaiset – draggable kapseli */
.draggable-task {
    padding: 0.35rem 0.55rem;
    background: rgba(126, 196, 255, 0.14);
    border: 1px dashed var(--accent);
    border-radius: var(--radius);
    cursor: grab;
    transition: box-shadow 120ms, opacity 120ms;
}

.draggable-task:hover {
    box-shadow: 0 0 0 2px var(--accent);
}

.draggable-task:active {
    cursor: grabbing;
    opacity: 0.6;
}

/* Täppä valmiille (strike-through + haalistetaan) */
input[type="checkbox"]:checked+span,
input[type="checkbox"]:checked~label span {
    text-decoration: line-through;
    color: var(--muted);
}

/* Pudotuskohteen korostus (lisää .dragover JS:ssä, jos haluat) */
.day-col.dragover {
    outline: 2px dashed var(--accent);
}

/* =========================================================
   6. PIENIÄ ANIMAATIOITA (BONUS)
   ========================================================= */
@keyframes pop {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.day-col,
#task-manager li,
.draggable-task {
    animation: pop 200ms ease-out;
}

.completed-day {
  background-color: rgba(126, 196, 255, 0.1);
  position: relative;
  transition: all 0.3s ease;
  border: 1px solid var(--accent);
}

.completed-day::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--accent);
  font-size: 1.2em;
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.completed-day h3 {
  color: var(--accent);
}

.completed-day ul li {
  opacity: 0.9;
}

.completed-day ul li label {
  color: var(--text);
}

/* =========================================================
   7. PRESETIT
   ========================================================= */
#presets-list {
  margin-top: 0.5rem;
}

.preset-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background: var(--surface-alt);
  border-radius: var(--radius);
  margin-bottom: 0.3rem;
}

.preset-actions {
  display: flex;
  gap: 0.3rem;
}

.load-preset {
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
}

.delete-preset {
  background: none;
  color: var(--accent);
  font-size: 1.2rem;
  padding: 0.2rem 0.4rem;
}

.delete-preset:hover {
  color: var(--accent-hover);
}

/* =========================================================
   8. STREAK
   ========================================================= */
#streak-display {
    opacity: 0;
    transition: opacity 0.3s ease;
}

#streak-display.active {
    opacity: 1;
}

.streak-info {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-alt);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    animation: pop 0.3s ease-out;
}

.streak-count {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
}

.streak-label {
    color: var(--text);
    font-size: 0.9rem;
}