/* =========================================================
   Aikataulu.com – UI-tyylit
   - Tumma oletusteema + vaihtoehdot (Snow, Ocean)
   - Kortit, napit, lomakkeet
   - Viikkokalenteri, nykyhetken viiva, tapahtumakortit
   ========================================================= */

/* Fontti */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

/* -------- Perusmuuttujat (default = tumma) -------- */
:root{
  --bg:#0b1220;
  --surface:#0f172a;
  --card:#0f172a;
  --text:#e5e7eb;
  --muted:#94a3b8;
  --border:#1f2937;

  --accent:#22c55e;
  --accent-600:#16a34a;
  --danger:#ef4444;
  --brand:#60a5fa;

  --radius:16px;
  --shadow:0 10px 30px rgba(2,6,23,.25);
  --shadow-sm:0 6px 18px rgba(2,6,23,.20);

  /* kalenterin yhden tunnin korkeus */
  --hour-h:56px;
}

/* -------- Teemat -------- */
/* Vaalea */
.theme-snow{
  --bg:#f6f7fb;
  --surface:#ffffff;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#475569;
  --border:#e5e7eb;
  --accent:#2563eb;
  --accent-600:#1d4ed8;
  --brand:#111827;
  --shadow:0 10px 30px rgba(2,6,23,.08);
  --shadow-sm:0 6px 18px rgba(2,6,23,.06);
}
/* Tummempi sinivihreä */
.theme-ocean{
  --bg:#06121f;
  --surface:#0a1a2b;
  --card:#0a1a2b;
  --text:#e6f0ff;
  --muted:#93b3d3;
  --border:#0e2742;
  --accent:#00d2d2;
  --accent-600:#00b0b0;
  --brand:#74b6ff;
}

/* -------- Reset & typografia -------- */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  color:var(--text);
  background:radial-gradient(1100px 500px at 70% -50%, rgba(32,212,196,.25), transparent 60%), var(--bg);
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  line-height:1.5;
}
a{ color:var(--brand); text-decoration:none; }
a:hover{ opacity:.9; }

/* -------- Yläpalkki -------- */
.topbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; gap:18px; justify-content:space-between;
  padding:14px 20px;
  background:var(--surface);
  border-bottom:1px solid var(--border);
  backdrop-filter:saturate(120%) blur(6px);
}
.brand{ display:flex; align-items:center; gap:10px; font-weight:800; letter-spacing:.2px; color:var(--text); }
.brand img{ height:32px; width:auto; display:block; }
.nav{ display:flex; gap:10px; }

/* -------- Napit -------- */
.btn,.btn-link{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 14px; border-radius:12px; border:1px solid var(--border);
  background:#0b1220; color:var(--text); cursor:pointer; box-shadow:var(--shadow-sm);
}
.btn:hover{ filter:brightness(1.05); }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--accent); color:#081018; border-color:transparent; box-shadow:0 10px 22px rgba(34,197,94,.25); }
.btn-primary:hover{ background:var(--accent-600); }
.btn-link{ background:transparent; border-color:transparent; color:var(--muted); box-shadow:none; }

/* -------- Kortit & layout -------- */
.container{ max-width:1200px; margin:28px auto; padding:0 18px; }
.card,.panel{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); padding:18px; }
.section-title{ margin:0 0 8px 0; }

/* -------- Lomakkeet -------- */
label{ display:block; font-weight:600; color:var(--muted); margin:10px 0 6px; }
input,select,textarea{
  width:100%;
  padding:12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#0b1422;
  color:var(--text);
  outline:none;
}
input:focus,select:focus,textarea:focus{ border-color:#334155; box-shadow:0 0 0 4px rgba(148,163,184,.25); }
textarea{ min-height:160px; resize:vertical; }
input[type="color"]{ padding:4px; height:44px; }
.form-grid{ display:grid; gap:14px; }
.form-2{ grid-template-columns:1fr 1fr; }
.form-3{ grid-template-columns:repeat(3,1fr); }
.form-actions{ display:flex; gap:12px; justify-content:flex-end; }

/* -------- Ilmoitukset -------- */
.alert{ background:rgba(239,68,68,.1); border:1px solid rgba(239,68,68,.4); color:#fecaca; padding:10px 12px; border-radius:12px; }
.ok{ background:rgba(34,197,94,.12); border:1px solid rgba(34,197,94,.4); color:#86efac; padding:10px 12px; border-radius:12px; }

/* -------- Etusivun pienet kortit -------- */
.grid{ display:grid; gap:14px; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); }
.tile{
  padding:14px; border-radius:14px; border:1px solid var(--border);
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0) 40%), var(--surface);
  display:flex; align-items:center; gap:10px; color:var(--text);
}
.tile .icon{ font-size:18px; opacity:.9; }

/* =========================================================
   KALENTERI – viikkonäkymä
   ========================================================= */
.week{ display:grid; grid-template-columns:72px repeat(7,1fr); gap:12px; align-items:start; }

/* manuaalinen 1 pv -tila */
body.view-one .week{ grid-template-columns:72px 1fr; }
body.view-one .day{ display:none; }
body.view-one .day:first-of-type{ display:flex; }

/* Tuntipylväs vasemmalla */
.timeline{
  height:calc(24 * var(--hour-h));
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
}
.timeline .hour{
  height:var(--hour-h);
  font-size:.8rem; color:var(--muted);
  border-bottom:1px dashed #1e293b;
  padding:6px 8px; display:flex; align-items:center;
}

/* Päiväkolumnit */
.day{ display:flex; flex-direction:column; gap:10px; min-width:0; }
.day-head{
  position:sticky; top:72px; z-index:1; text-align:center; font-weight:800;
  padding:10px; border-radius:12px; border:1px solid var(--border);
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0) 40%), var(--surface);
  box-shadow:var(--shadow-sm);
}
.day-head small{ display:block; color:var(--muted); font-weight:600; }
.day-head.today{ outline:2px solid var(--accent); }

.day-body{
  position:relative;
  height:calc(24 * var(--hour-h));
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;

  /* tuntirasteri */
  background-image:
    linear-gradient(#1e293b 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size:100% var(--hour-h), 100% 1px;
}
.grid-capture{ cursor:crosshair; }

/* Tapahtumakortti */
.event-card{
  position:absolute; left:10px; right:10px;
  padding:10px 12px;
  border-left:6px solid var(--accent);
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border:1px solid var(--border);
  border-radius:12px;
  box-shadow:var(--shadow-sm);
  color:var(--text);
  user-select:none;
}
.event-card:hover{ box-shadow:0 12px 24px rgba(2,6,23,.28); }
.event-title{ font-weight:700; }
.event-meta{ font-size:.85rem; color:var(--muted); margin-top:4px; }

/* Nykyhetken viiva + badge */
.now-line{ position:absolute; left:0; right:0; height:2px; background:var(--danger); }
.now-badge{
  position:absolute; right:8px; transform:translateY(-50%);
  font-size:.75rem; background:var(--danger); color:#fff;
  padding:2px 8px; border-radius:999px; box-shadow:var(--shadow-sm);
}

/* Taulukkolistat */
.table{ display:grid; gap:10px; }
.table .thead,.table .row{ display:grid; align-items:center; gap:12px; grid-template-columns:2fr 2fr 1.3fr 2fr .8fr .8fr; }
.table .thead{
  font-weight:700; color:var(--text);
  background:var(--surface); border:1px solid var(--border);
  border-radius:12px; padding:10px 12px; box-shadow:var(--shadow-sm);
}
.table .row{
  background:var(--surface); border:1px solid var(--border);
  border-radius:12px; padding:10px 12px; box-shadow:var(--shadow-sm);
}

/* Login-kortti */
.login-card{ max-width:420px; margin:12vh auto; padding:28px; }
.login-card h1{ margin:0 0 8px 0; }
.subtitle{ color:var(--muted); margin:0 0 16px; }

/* Footer */
.footer{ color:var(--muted); font-size:.9rem; padding:24px 0; text-align:center; }

/* --- Touch (mobiili): 1 pv + tuntipylväs --- */
@media (hover: none) and (pointer: coarse) {
  .week{ grid-template-columns:72px 1fr; }
  .day{ display:none; }
  .day:first-of-type{ display:flex; }
  .topbar{ top:0; }
}

/* --- Kapea desktop / läppäri: 7 pv, mutta vaakavieritys --- */
@media (max-width: 980px) and (hover: hover) and (pointer: fine) {
  .week{
    grid-template-columns:72px repeat(7, minmax(160px, 1fr));
    overflow-x:auto;
  }
  .day{ display:flex; min-width:160px; }
}


/* -------- Utilit -------- */
.mt-0{ margin-top:0!important; }
.mt-2{ margin-top:8px!important; }
.mt-3{ margin-top:12px!important; }
.mb-0{ margin-bottom:0!important; }
.mb-2{ margin-bottom:8px!important; }
.text-muted{ color:var(--muted)!important; }
.badge{ display:inline-flex; align-items:center; gap:6px; font-weight:700; border-radius:999px; padding:6px 10px; border:1px solid var(--border); background:var(--surface); }
.badge-danger{ background:rgba(239,68,68,.15); border-color:rgba(239,68,68,.45); color:#fecaca; }
