/* Notes for CloudPhone - shared styles
 * Developer: Tasmon Islam
 */

:root {
  font-family: 'Roboto', sans-serif;
}

/* ---------- Theme variables ---------- */

html[data-theme="dark"], html:not([data-theme]) {
  --bg: #000000;
  --fg: #ffffff;
  --muted-fg: #cfcfcf;
  --bar-bg: #111111;
  --border: #222222;
  --card-bg: #111111;
  --accent: #1971e6;
  --accent-fg: #ffffff;
  --danger-bg: #3a1111;
  --danger-fg: #ff8080;
  --danger-border: #5c1a1a;
}

html[data-theme="light"] {
  --bg: #f2f2f2;
  --fg: #111111;
  --muted-fg: #444444;
  --bar-bg: #e2e2e2;
  --border: #cccccc;
  --card-bg: #ffffff;
  --accent: #1971e6;
  --accent-fg: #ffffff;
  --danger-bg: #ffe6e6;
  --danger-fg: #b30000;
  --danger-border: #ffb3b3;
}

html[data-theme="amber"] {
  --bg: #000000;
  --fg: #ffd699;
  --muted-fg: #d9b273;
  --bar-bg: #1a1200;
  --border: #332200;
  --card-bg: #140f00;
  --accent: #ffb300;
  --accent-fg: #000000;
  --danger-bg: #3a1111;
  --danger-fg: #ff9d6a;
  --danger-border: #5c1a1a;
}

html[data-theme="ocean"] {
  --bg: #00131a;
  --fg: #cfefff;
  --muted-fg: #8fbdd1;
  --bar-bg: #00232f;
  --border: #013042;
  --card-bg: #001c26;
  --accent: #00b0ff;
  --accent-fg: #00131a;
  --danger-bg: #331018;
  --danger-fg: #ff9d9d;
  --danger-border: #501822;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  position: fixed;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
}

a {
  color: var(--accent);
}

button {
  font-family: inherit;
}

/* Header */
header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  line-height: 36px;
  background: var(--bar-bg);
  text-align: center;
  font-weight: bold;
  font-size: 14pt;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6pt;
  z-index: 2;
  border-bottom: 1px solid var(--border);
}

/* Content */
#app {
  position: absolute;
  top: 36px;
  bottom: 36px;
  left: 0;
  right: 0;
  overflow-y: auto;
  padding: 6pt 8pt;
}

/* Footer softkey bar */
footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  display: flex;
  background: var(--bar-bg);
  color: var(--fg);
  z-index: 2;
  border-top: 1px solid var(--border);
}

.softkey {
  flex: 1 1 33.3%;
  display: flex;
  align-items: center;
  font-size: 10pt;
  padding: 0 8pt;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#softkey-left { justify-content: flex-start; }
#softkey-center { justify-content: center; text-transform: uppercase; font-weight: bold; }
#softkey-right { justify-content: flex-end; }

/* QQVGA */
@media only screen and (max-width: 128px) {
  header { height: 20px; line-height: 20px; font-size: 9pt; }
  #app { top: 20px; bottom: 20px; padding: 3pt 4pt; }
  footer { height: 20px; }
  .softkey { font-size: 7pt; padding: 0 4pt; }
}

/* ---------- Notes list ---------- */

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.note-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--fg);
  padding: 6pt 4pt;
  margin-bottom: 4pt;
  border-bottom: 1px solid var(--border);
  border-radius: 4px;
}

.note-item:focus,
.note-item.focused {
  background-color: var(--accent);
  color: var(--accent-fg);
  outline: none;
}

.note-title {
  display: block;
  font-weight: bold;
  font-size: 11pt;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.type-badge {
  display: inline-block;
  font-size: 7pt;
  font-weight: bold;
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0 3pt;
  margin-left: 6pt;
  vertical-align: middle;
  opacity: 0.8;
}

.note-snippet {
  display: block;
  font-size: 9pt;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-date {
  display: block;
  font-size: 8pt;
  opacity: 0.6;
  margin-top: 2pt;
}

.empty-state {
  text-align: center;
  opacity: 0.7;
  margin-top: 24pt;
  padding: 0 8pt;
  font-size: 10pt;
}

/* ---------- Note editor ---------- */

.field-label {
  display: block;
  font-size: 8pt;
  opacity: 0.7;
  margin: 6pt 0 2pt;
  text-transform: uppercase;
}

#note-title {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 11pt;
  padding: 6pt;
  border-radius: 4px;
}

#note-body {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 10pt;
  padding: 6pt;
  border-radius: 4px;
  margin-top: 6pt;
  resize: none;
  height: 130px;
}

#note-title:focus,
#note-body:focus {
  outline: 1px solid var(--accent);
}

/* ---------- Checklist editor ---------- */

.checklist {
  margin-top: 4pt;
}

.checklist-row {
  display: flex;
  align-items: center;
  gap: 4pt;
  margin-bottom: 4pt;
}

.checklist-checkbox {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.checklist-text {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 10pt;
  padding: 5pt 6pt;
  border-radius: 4px;
}

.checklist-text.checked {
  text-decoration: line-through;
  opacity: 0.55;
}

.checklist-text:focus {
  outline: 1px solid var(--accent);
}

.checklist-del {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--danger-fg);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 9pt;
  line-height: 1;
}

.checklist-add-row {
  display: flex;
  gap: 4pt;
  margin-top: 8pt;
}

.checklist-add-input {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 10pt;
  padding: 5pt 6pt;
  border-radius: 4px;
}

.checklist-add-input:focus {
  outline: 1px solid var(--accent);
}

.checklist-add-btn {
  flex: 0 0 auto;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  padding: 5pt 10pt;
  border-radius: 4px;
  font-size: 9pt;
}

/* ---------- Settings ---------- */

.setting-row {
  margin-bottom: 12pt;
}

.setting-row label {
  display: block;
  font-size: 9pt;
  margin-bottom: 4pt;
  opacity: 0.85;
}

.setting-row select {
  width: 100%;
  background: var(--card-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 6pt;
  font-size: 10pt;
  border-radius: 4px;
}

.danger-btn {
  width: 100%;
  background: var(--danger-bg);
  color: var(--danger-fg);
  border: 1px solid var(--danger-border);
  padding: 8pt;
  font-size: 10pt;
  border-radius: 4px;
  margin-top: 12pt;
}

.danger-btn:focus {
  outline: 1px solid var(--danger-fg);
}

/* ---------- Backup / Restore ---------- */

.action-btn {
  width: 100%;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  padding: 8pt;
  font-size: 10pt;
  border-radius: 4px;
  margin-top: 6pt;
}

.action-btn:focus {
  outline: 1px solid var(--fg);
}

.hint {
  font-size: 8pt;
  opacity: 0.65;
  margin: 4pt 0 10pt;
}

.section-title {
  font-size: 10pt;
  font-weight: bold;
  margin: 10pt 0 4pt;
  text-transform: uppercase;
  opacity: 0.85;
}

/* ---------- About / Help ---------- */

.about-box {
  text-align: center;
  margin-top: 20pt;
}

.about-box .app-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 8pt;
  border-radius: 12px;
}

.about-box h2 {
  margin: 0 0 4pt;
  font-size: 14pt;
}

.about-box p {
  margin: 2pt 0;
  font-size: 9pt;
  opacity: 0.85;
}

.help-list {
  margin: 0;
  padding-left: 14pt;
  font-size: 9pt;
  line-height: 1.5;
}

.help-list li {
  margin-bottom: 6pt;
}

/* ---------- Options menu (LSK) ---------- */

menu.options-menu {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: var(--bg);
  margin: 0;
  padding: 36px 0 36px;
  overflow-y: auto;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 11pt;
  padding: 10pt 12pt;
}

.menu-item.focused,
.menu-item:focus {
  background-color: var(--accent);
  color: var(--accent-fg);
  outline: none;
}

.menu-item.danger {
  color: var(--danger-fg);
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16pt;
}

.modal-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12pt;
  width: 100%;
  max-width: 220px;
}

.modal-message {
  font-size: 10pt;
  margin: 0 0 12pt;
  line-height: 1.4;
  color: var(--fg);
}

.modal-buttons {
  display: flex;
  gap: 6pt;
}

.modal-btn {
  flex: 1;
  background: var(--bar-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 6pt;
  font-size: 9pt;
  border-radius: 4px;
}

.modal-btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.modal-btn:focus {
  outline: 1px solid var(--fg);
}

/* Font size setting */
html[data-fontsize="large"] .note-title { font-size: 13pt; }
html[data-fontsize="large"] .note-snippet { font-size: 11pt; }
html[data-fontsize="large"] #note-body { font-size: 12pt; }
html[data-fontsize="large"] #note-title { font-size: 13pt; }
html[data-fontsize="large"] .checklist-text { font-size: 12pt; }
html[data-fontsize="large"] .checklist-add-input { font-size: 12pt; }
