:root {
  --md-bg: #FAFAFA; --md-surface: #FFFFFF; --md-on-surface: #1C1B1F;
  --md-primary: #6750A4; --md-on-primary: #FFFFFF; --md-surface-variant: #E7E0EC;
  --md-outline: #79747E; --nav-size: 80px;
}

:root[data-theme="dark"] {
  --md-bg: #141218; --md-surface: #2B2930; --md-on-surface: #E6E1E5;
  --md-primary: #D0BCFF; --md-on-primary: #381E72; --md-surface-variant: #49454F;
  --md-outline: #938F99;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --md-bg: #141218; --md-surface: #2B2930; --md-on-surface: #E6E1E5;
    --md-primary: #D0BCFF; --md-on-primary: #381E72; --md-surface-variant: #49454F;
    --md-outline: #938F99;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Roboto', sans-serif; }

body { background-color: var(--md-bg); color: var(--md-on-surface); display: flex; flex-direction: column; height: 100vh; overflow: hidden; transition: background-color 0.3s, color 0.3s; }

#app-content { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 90px; scroll-behavior: smooth; }

h1 { font-size: 24px; margin-bottom: 16px; font-weight: 500; }
h3 { margin-bottom: 12px; font-weight: 500; }
h4 { margin-bottom: 12px; font-weight: 500; font-size: 16px; }
hr { border: 0; height: 1px; background: var(--md-outline); margin: 16px 0; opacity: 0.3; }

.m3-card { position: relative; background: var(--md-surface); border-radius: 16px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.12); transition: background-color 0.3s; }
.m3-input { width: 100%; padding: 12px 16px; margin-bottom: 12px; border-radius: 4px; border: 1px solid var(--md-outline); background: transparent; color: var(--md-on-surface); }
.m3-input:focus { outline: 2px solid var(--md-primary); }

select.m3-input { background-color: var(--md-surface); }
select.m3-input option { background-color: var(--md-surface); color: var(--md-on-surface); }

.checkbox-label { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; }

.field-group { display: flex; gap: 8px; width: 100%; }
.field-group > div { flex: 1; }
.field-label { display: block; margin-bottom: 4px; font-size: 14px; opacity: 0.8;}

.m3-button { padding: 10px 24px; border-radius: 20px; border: none; font-weight: 500; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.m3-button.primary { background: var(--md-primary); color: var(--md-on-primary); }
.m3-button.secondary { background: var(--md-surface-variant); color: var(--md-on-surface); }
.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.icon-btn-close { position: absolute; top: 12px; right: 12px; background: var(--md-surface-variant); color: var(--md-on-surface); border: none; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0.8; transition: 0.2s; }
.icon-btn-close:hover { opacity: 1; transform: scale(1.1); }

.contrast-box { background: var(--md-surface-variant); padding: 12px; border-radius: 8px; margin-top: 8px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.contrast-box span { font-weight: 500; }
.contrast-box small { font-size: 12px; opacity: 0.8; }

.setting-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 16px; flex-wrap: wrap;}
.setting-row label { font-weight: 500; }
.setting-row input[type="color"] { width: 50px; height: 40px; padding: 0; border: none; border-radius: 4px; cursor: pointer; background: transparent; }

/* FAQ Accordion Styling */
.faq-item { margin-bottom: 8px; border: 1px solid var(--md-outline); border-radius: 8px; overflow: hidden; }
.faq-item summary { font-weight: 500; cursor: pointer; padding: 12px 16px; background: var(--md-surface-variant); outline: none; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "expand_more"; font-family: 'Material Symbols Outlined'; font-size: 20px; transition: transform 0.3s ease; }
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item p { padding: 12px 16px; font-size: 14px; opacity: 0.9; line-height: 1.5; border-top: 1px solid var(--md-outline); }

.m3-nav { position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-size); background: var(--md-surface-variant); display: flex; justify-content: space-around; align-items: center; z-index: 100; transition: background-color 0.3s; }
.nav-item { background: transparent; border: none; color: var(--md-on-surface); display: flex; flex-direction: column; align-items: center; cursor: pointer; opacity: 0.7; transition: color 0.3s; }
.nav-item.active { opacity: 1; font-weight: bold; color: var(--md-primary); }

.view { display: none; }
.view.active { display: block; }

#qr-canvas-container { display: flex; justify-content: center; background: white; padding: 16px; border-radius: 8px; margin-bottom: 16px; }

@media (min-width: 768px) {
  body { flex-direction: row; }
  #app-content { padding-right: calc(var(--nav-size) + 20px); padding-bottom: 16px; }
  .m3-nav { top: 0; bottom: 0; left: auto; right: 0; width: var(--nav-size); height: 100vh; flex-direction: column; justify-content: center; gap: 32px; border-left: 1px solid var(--md-outline); }
}