/* app/static/app.css */
/* Mobile-first, clean iPhone-friendly UI. */

:root{
  --bg: #ffffff;
  --surface: #ffffff;
  --border: #e7e7ea;
  --border-strong: #d5d5da;
  --text: #111827;
  --muted: #6b7280;
  --danger: #b00020;
}

/* Base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

.container{
  padding: 12px;
  max-width: 760px;
  margin: 0 auto;
}

/* Top bar */
.topbar{
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand{
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.spacer{ flex: 1; }

/* Headings */
h1{
  margin: 10px 0 12px;
  font-size: 30px;
  line-height: 1.1;
}

h2{
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.2;
}

/* Cards */
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin: 10px 0;
}

/* Forms */
label{
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input{
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  font-size: 16px; /* keep >=16 to prevent iOS zoom */
  line-height: 1.2;
}

input:focus{
  outline: none;
  border-color: #9ca3af;
}

/* Buttons */
.btn{
  appearance: none;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.btn:hover{ border-color: #9ca3af; }
.btn:active{ transform: translateY(0.5px); }

.btn.primary{
  font-weight: 700;
  border-color: #111827;
}

.btn.danger {
  border: none;
  color: #ff3b30;
  background: none;
  font-weight: 500;
}

/* Error */
.error{
  padding: 10px 12px;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 14px;
  margin-bottom: 12px;
  background: #fff;
}

/* Grid layout (mobile-first) */
.grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.grid .full{ grid-column: 1 / -1; }

/* iOS-style event list */
.events {
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}

.event-card {
  padding: 12px 0;
  border-bottom: 1px solid #e5e5ea;
  background: transparent;
}

.event-card:last-child {
  border-bottom: none;
}

.event-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}

.event-when {
  font-size: 13px;
  color: #8e8e93;
  min-width: 90px;
  white-space: nowrap;
}

.event-desc {
  flex: 1;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-actions {
  display: flex;
  gap: 6px;
}

/* Edit form inside a card */
.event-edit-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* Legacy helpers (safe to keep; may be unused now) */
.actions{ display:flex; gap: 10px; flex-wrap: wrap; }
.inline{ display:flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline input{ width:auto; }

/* Desktop-ish improvements */
@media (min-width: 900px){
  .container{ padding: 16px; max-width: 900px; }
  h1{ font-size: 34px; }
  .card{ padding: 14px; }

  /* Two-column add-event form on larger screens */
  .grid{ grid-template-columns: 1fr 1fr; }
  .grid .full{ grid-column: 1 / -1; }

  /* If you ever want two-column edit grid on desktop */
  .event-edit-grid{ grid-template-columns: 1fr 1fr; }
  .event-edit-grid input:nth-child(3){ grid-column: 1 / -1; }
}

/* Table styling (if you still have tables anywhere) */
.table{
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td{
  border-bottom: 1px solid var(--border);
  padding: 10px;
  vertical-align: top;
}

/* Compact event row layout */
.event-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.event-when {
  font-size: 13px;
  color: #666;
  min-width: 90px;
  white-space: nowrap;
}

.event-desc {
  flex: 1;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-actions {
  display: flex;
  gap: 6px;
}

.btn.small {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 10px;
}

@media (max-width: 380px) {
  .event-main {
    flex-wrap: wrap;
  }
}

/* Compact Add Event row */
.add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
}

.add-row input {
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 10px;
}

.add-row input[type="date"] {
  width: 110px;
}

.add-row input[type="time"] {
  width: 80px;
}

.add-row input[name="description"] {
  flex: 1;
}

.add-row .btn.small {
  padding: 6px 10px;
}

@media (max-width: 420px) {
  .add-row {
    flex-wrap: wrap;
  }

  .add-row input[type="date"],
  .add-row input[type="time"] {
    width: auto;
  }
}

/* Add panel */
.add-panel {
  margin: 8px 0 12px;
}

.hidden {
  display: none !important;
}

/* Floating + button (FAB) */
.fab {
  position: fixed;
  right: 18px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: none;
  background: #111827;
  color: #fff;
  font-size: 32px;
  line-height: 56px;
  text-align: center;
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  cursor: pointer;
  z-index: 9999;
}

.fab:active {
  transform: translateY(1px);
}

/* Keep FAB above iPhone Safari bottom bar a bit */
@media (max-width: 640px) {
  .fab { bottom: 28px; }
}
