/* =============================================================================
 *  BBA Magic Hour  —  styles.css
 *  Google Material look & feel  •  Powered by Digital Daksh
 * ========================================================================== */

:root {
  --g-blue:   #4285F4;
  --g-blue-d: #1a73e8;
  --g-red:    #EA4335;
  --g-yellow: #F9AB00;
  --g-green:  #34A853;

  --bg:        #f5f6f8;
  --surface:   #ffffff;
  --on-surface:#202124;
  --muted:     #5f6368;
  --line:      #e4e6eb;
  --line-soft: #eef0f3;

  --primary:   var(--g-blue);
  --primary-d: var(--g-blue-d);

  --radius:    16px;
  --radius-sm: 10px;
  --shadow-1:  0 1px 2px rgba(60,64,67,.12), 0 1px 3px rgba(60,64,67,.08);
  --shadow-2:  0 2px 6px rgba(60,64,67,.14), 0 1px 2px rgba(60,64,67,.10);
  --shadow-3:  0 6px 18px rgba(60,64,67,.18);

  --nav-h: 64px;
  --header-h: 60px;

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--on-surface);
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body { font-size: 16px; }              /* 16px inputs => no iOS zoom on focus */

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

/* ------------------------------------------------------------------ App shell */
#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--safe-top);
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-2);
}
.app-header__bar {
  height: var(--header-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
}
.app-header__back {
  border: 0; background: transparent; color: #fff;
  width: 40px; height: 40px; border-radius: 50%;
  display: none; align-items: center; justify-content: center; cursor: pointer;
}
.app-header__back.show { display: inline-flex; }
.app-header__back:active { background: rgba(255,255,255,.18); }
.app-header__title {
  font-size: 20px; font-weight: 500; letter-spacing: .2px;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-header__logo {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; grid-template-columns: 1fr 1fr; overflow: hidden;
}
.app-header__logo i { display: block; }

/* --------------------------------------------------------------- Main content */
main {
  flex: 1;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-bottom) + 20px);
  max-width: 720px; width: 100%; margin: 0 auto;
}
.view { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-label {
  font-size: 12px; font-weight: 600; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted);
  margin: 4px 2px 10px;
}
.subtle { color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------------- Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 16px;
  margin-bottom: 14px;
}
.card--pad-lg { padding: 20px; }

/* --------------------------------------------------- Home hero + tile grid */
.hero {
  background: linear-gradient(135deg, var(--g-blue), #6aa1ff);
  color: #fff; border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 18px;
  box-shadow: var(--shadow-2);
  position: relative; overflow: hidden;
}
.hero h1 { margin: 0 0 4px; font-size: 22px; font-weight: 500; }
.hero p { margin: 0; opacity: .92; font-size: 14px; line-height: 1.4; }
.hero__chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; background: rgba(255,255,255,.2);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
}

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  background: var(--surface); border: 0; text-align: left; cursor: pointer;
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: 10px;
  min-height: 128px; position: relative; overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
}
.tile:active { transform: scale(.97); box-shadow: var(--shadow-2); }
.tile--wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 0; }
.tile__icon {
  width: 46px; height: 46px; border-radius: 12px; flex: none;
  display: grid; place-items: center; color: #fff;
}
.tile__icon .material-symbols-rounded { font-size: 26px; }
.tile__body { flex: 1; }
.tile__title { font-size: 16px; font-weight: 500; margin: 0; }
.tile__sub { font-size: 12.5px; color: var(--muted); margin: 3px 0 0; line-height: 1.35; }
.tile__count {
  position: absolute; top: 12px; right: 14px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--line-soft); padding: 2px 9px; border-radius: 999px;
}

/* -------------------------------------------------------- Quadrant banner */
.qbanner {
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
  color: #fff; box-shadow: var(--shadow-1);
}
.qbanner h2 { margin: 0; font-size: 18px; font-weight: 500; }
.qbanner p { margin: 4px 0 0; font-size: 13px; opacity: .95; }

/* ------------------------------------------------------------ Date bar */
.datebar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 16px; box-shadow: var(--shadow-1);
}
.datebar label { font-size: 13px; color: var(--muted); font-weight: 500; }
.datebar input { flex: 1; }
.datebar__btn {
  border: 0; background: var(--line-soft); color: var(--muted);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.datebar__btn:active { background: #e3e6eb; }

/* ------------------------------------------------------------- Task cards */
.task {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-1); margin-bottom: 12px;
  border-left: 4px solid var(--muted); overflow: hidden;
}
.task__head { padding: 14px 16px; }
.task__row { display: flex; align-items: flex-start; gap: 10px; }
.task__title { font-size: 16px; font-weight: 500; margin: 0; flex: 1; }
.task__desc { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; line-height: 1.4; }
.task__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 11.5px; font-weight: 500; padding: 4px 10px; border-radius: 999px;
  background: var(--line-soft); color: var(--muted);
  display: inline-flex; align-items: center; gap: 4px;
}
.chip .material-symbols-rounded { font-size: 14px; }
.chip--theme  { background: #e8f0fe; color: #1967d2; }
.chip--date   { background: #f1f3f4; color: #5f6368; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* status colours */
.st-not-started { background:#9aa0a6; }
.st-in-progress { background: var(--g-blue); }
.st-completed   { background: var(--g-green); }
.st-on-hold     { background: var(--g-yellow); }

.task__log {
  border-top: 1px solid var(--line-soft);
  padding: 12px 16px; background: #fafbfc;
}
.task__log label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 5px; margin-bottom: 6px;
}
.task__log textarea { min-height: 62px; resize: vertical; }
.log-saved {
  font-size: 12px; color: var(--g-green); font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px;
  opacity: 0; transition: opacity .2s;
}
.log-saved.show { opacity: 1; }

.qflags { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }
.qflag { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.qflag input { width: 18px; height: 18px; accent-color: var(--g-red); }

/* icon action buttons on a task */
.iconbtn {
  border: 0; background: transparent; color: var(--muted);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  display: inline-grid; place-items: center; flex: none;
}
.iconbtn:active { background: var(--line-soft); }
.iconbtn .material-symbols-rounded { font-size: 20px; }

/* ------------------------------------------------------------- Form fields */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block; font-size: 13px; font-weight: 500; color: var(--muted);
  margin-bottom: 6px;
}
input[type=text], input[type=email], input[type=tel],
input[type=date], input[type=time], select, textarea {
  width: 100%; font-size: 16px; font-family: inherit; color: var(--on-surface);
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(66,133,244,.15);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px;
}
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }

/* --------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 15px; font-weight: 500;
  padding: 12px 22px; transition: box-shadow .15s, background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-1); }
.btn--primary:active { background: var(--primary-d); }
.btn--tonal { background: #e8f0fe; color: var(--primary-d); }
.btn--ghost { background: transparent; color: var(--primary-d); }
.btn--danger { background: #fce8e6; color: #c5221f; }
.btn--block { width: 100%; }
.btn .material-symbols-rounded { font-size: 20px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Floating action button */
.fab {
  position: fixed; right: 18px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 18px);
  width: 56px; height: 56px; border-radius: 18px; border: 0;
  background: var(--primary); color: #fff; box-shadow: var(--shadow-3);
  display: grid; place-items: center; cursor: pointer; z-index: 25;
  transition: transform .12s;
}
.fab:active { transform: scale(.94); }
.fab .material-symbols-rounded { font-size: 28px; }

/* --------------------------------------------------------- Bottom nav */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex; box-shadow: 0 -1px 4px rgba(60,64,67,.08);
}
.nav-item {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 11px; font-weight: 500;
  padding-top: 6px; position: relative;
}
.nav-item .material-symbols-rounded { font-size: 24px; transition: transform .12s; }
.nav-item.active { color: var(--primary); }
.nav-item.active .icon-pill {
  background: #e8f0fe;
}
.icon-pill {
  width: 56px; height: 30px; border-radius: 999px;
  display: grid; place-items: center; transition: background .15s;
}
.nav-item:active .material-symbols-rounded { transform: scale(.9); }

/* --------------------------------------------------------------- Empty state */
.empty {
  text-align: center; padding: 44px 20px; color: var(--muted);
}
.empty .material-symbols-rounded { font-size: 48px; opacity: .5; }
.empty h3 { margin: 12px 0 4px; font-weight: 500; color: var(--on-surface); }
.empty p { margin: 0; font-size: 14px; }

/* ------------------------------------------------------------- Setup lists */
.chip-editor { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip-edit {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--line-soft); border-radius: 999px; padding: 6px 8px 6px 14px;
  font-size: 13.5px;
}
.chip-edit button {
  border: 0; background: transparent; cursor: pointer; color: var(--muted);
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
}
.chip-edit button:active { background: #dfe2e7; }
.inline-add { display: flex; gap: 8px; margin-top: 12px; }
.inline-add input { flex: 1; }

.setup-section > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  padding: 4px 0;
}
.setup-section > summary::-webkit-details-marker { display: none; }
.setup-section summary .material-symbols-rounded.chev { margin-left: auto; transition: transform .2s; color: var(--muted); }
.setup-section[open] summary .chev { transform: rotate(180deg); }
.setup-section .sect-icon {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  display: grid; place-items: center; color: #fff;
}
.setup-section .sect-title { font-size: 15.5px; font-weight: 500; }
.setup-section .sect-sub { font-size: 12.5px; color: var(--muted); }
.setup-body { padding-top: 14px; margin-top: 2px; border-top: 1px solid var(--line-soft); }

/* ------------------------------------------------------------- Share tab */
.seg {
  display: flex; background: var(--line-soft); border-radius: 999px; padding: 4px; gap: 4px;
  margin-bottom: 16px;
}
.seg button {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 9px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--muted);
}
.seg button.active { background: var(--surface); color: var(--primary-d); box-shadow: var(--shadow-1); }
.preview {
  background: #fafbfc; border: 1px dashed var(--line);
  border-radius: var(--radius-sm); padding: 16px; white-space: pre-wrap;
  font-size: 13.5px; line-height: 1.5; color: #3c4043;
  max-height: 340px; overflow: auto; margin: 6px 0 16px;
}

/* ------------------------------------------------------------- About tab */
.about-logo {
  width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 14px;
  display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; box-shadow: var(--shadow-2);
}
.about-logo i { display:block; }
.about h2 { text-align: center; margin: 0 0 2px; font-weight: 500; }
.about .ver { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.brand-line { display:flex; align-items:center; justify-content:center; gap:8px; font-weight:500; color: var(--primary-d); }

/* --------------------------------------------------------------- Toast */
#toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 20px);
  background: #323232; color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 14px; box-shadow: var(--shadow-3); z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: 90%;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --------------------------------------------------------------- Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 70;
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-backdrop.show { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); width: 100%; max-width: 560px;
  border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + var(--safe-bottom));
  max-height: 92vh; overflow: auto;
  transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.modal-backdrop.show .modal { transform: translateY(0); }
.modal__grip { width: 40px; height: 4px; background: var(--line); border-radius: 2px; margin: 0 auto 14px; }
.modal__title { font-size: 19px; font-weight: 500; margin: 0 0 16px; }
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 24px; }
}

/* --------------------------------------------------- Update / offline banner */
.update-banner {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px); z-index: 55;
  background: #202124; color: #fff; border-radius: 12px;
  padding: 12px 14px; display: none; align-items: center; gap: 12px;
  box-shadow: var(--shadow-3);
}
.update-banner.show { display: flex; }
.update-banner span { flex: 1; font-size: 14px; }
.update-banner button {
  border: 0; background: var(--g-blue); color: #fff; font-weight: 500;
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font-size: 14px;
}

.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }
.hidden { display: none !important; }
