/* TAKTO Stylesheet - Minimalist, Accessible, Notion-like */
:root {
  --bg-color: #f7f7f8;
  --input-bg: #fff;
  --text-color: #18191a;
  --primary: #23272f;
  --secondary: #f3f3f4;
  --accent: #e5e7eb;
  --border-color: #ececec;
  --border-highlight: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --radius: 0.75rem;
  --font-family: "Inter", "Segoe UI", "Arial", "system-ui", sans-serif;
  --font-size: 1rem;
  --line-height: 1.7;
  --sidebar-width: 300px;
  --focus-outline: 2.5px solid #23272f;
  --focus-outline-dark: 2.5px solid #bdbdbd;
  --skip-link-bg: #23272f;
  --skip-link-color: #fff;
  --header-height: 64px;
}

.no-js:root {
  --bg-color: #f7f7f8;
  --input-bg: #fff;
  --text-color: #18191a;
  --primary: #23272f;
  --secondary: #f3f3f4;
  --accent: #e5e7eb;
  --border-color: #ececec;
  --border-highlight: #e0e0e0;
  --focus-outline: 2.5px solid #23272f;
  --skip-link-bg: #23272f;
  --skip-link-color: #fff;
}

html,
body {
  height: 100%;
  width: 100vw;
  overflow: hidden;
  /* overflow-y: auto; */
}

.center-flex {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-height: 100vh;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  box-sizing: border-box;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 0 2rem;
  height: var(--header-height);
}
.logo {
  display: block;
  height: 44px;
  width: 90px;
  margin-right: 0;
  cursor: pointer;
}

body {
  background: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: var(--font-size);
  line-height: var(--line-height);
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.app-container {
  display: flex;
  flex: 1 1 0%;
  width: 100vw;
  max-width: 100vw;
  height: calc(100vh - var(--header-height));
  min-height: 0;
  min-width: 0;
  background: var(--input-bg);
  box-shadow: var(--shadow);
  overflow: hidden;
  box-sizing: border-box;
}

.sidebar {
  flex: 0 0 auto;
  background: var(--input-bg);
  border-right: 1.5px solid var(--border-highlight);
  padding: 2rem 1rem 2rem 1.5rem;
  min-width: 220px;
  max-width: 100vw;
  min-height: 0;
  height: calc(100vh - var(--header-height) - 48px);
  box-sizing: border-box;
  width: var(--sidebar-width);
  font-size: 0.97rem;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

.main-content-area {
  flex: 1 1 0%;
  padding: 2rem 2.5rem;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  height: calc(100vh - var(--header-height) - 48px);
  box-sizing: border-box;
  max-width: 100vw;
}

header,
footer {
  width: 100vw;
  max-width: 100vw;
  background: var(--input-bg);
  border-bottom: 1.5px solid var(--border-highlight);
  box-shadow: var(--shadow);
  padding: 0.5rem 0;
  box-sizing: border-box;
}
footer {
  border-top: 1.5px solid var(--border-highlight);
  border-bottom: none;
  text-align: center;
  font-size: 0.93rem;
  margin-top: 0;
  background: var(--input-bg);
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 2rem;
  min-height: 48px;
  position: relative;
  z-index: 10;
  width: 100vw;
  max-width: 100vw;
  box-sizing: border-box;
  overflow-x: hidden;
}
.footer-info {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}
.footer-credits {
  font-size: 0.92rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-wrap: wrap;
}
#theme-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.3rem;
  background: rgba(180, 180, 180, 0.1);
  color: var(--text-color);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: background 0.18s, color 0.18s;
  cursor: pointer;
  margin-left: 2rem;
}
#theme-toggle-btn:focus,
#theme-toggle-btn:hover {
  background: var(--accent);
  outline: var(--focus-outline);
}

.header-nav ul {
  display: flex;
  gap: 2.5rem;
  list-style: none;
  margin: 0;
  padding: 0 2rem;
}
.header-nav a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.4em 0.7em;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.header-nav a[aria-current="page"],
.header-nav a:focus {
  background: var(--accent);
  color: var(--text-color);
  outline: var(--focus-outline);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 1000;
  background: var(--skip-link-bg);
  color: var(--skip-link-color);
  padding: 0.5em 1em;
  border-radius: var(--radius);
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  outline: var(--focus-outline);
}

#static-links-container section {
  margin-bottom: 2rem;
}
#static-links-container h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  margin-top: 0;
}
#static-links-container ul {
  list-style: none;
  padding: 0 0 0 0.5em;
  margin: 0;
}
#static-links-container li {
  margin-bottom: 0.4em;
}
#static-links-container a {
  color: var(--primary);
  text-decoration: underline;
  border-radius: var(--radius);
  padding: 0.2em 0.4em;
  transition: background 0.2s;
}
#static-links-container a:focus {
  background: var(--secondary);
  outline: var(--focus-outline);
  outline-offset: 2px;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 1.2rem 0 0.7rem 0;
  letter-spacing: 0.01em;
}

.content-section,
.app-section {
  background: var(--input-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-highlight);
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  padding: 0.5em 1em;
  background: var(--input-bg);
  color: var(--text-color);
  transition: border 0.2s, box-shadow 0.2s;
}
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: var(--focus-outline);
  outline-offset: 2px;
  border-color: var(--primary);
}
button {
  cursor: pointer;
  font-weight: 600;
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: var(--shadow);
  transition: background 0.2s;
}
button:hover,
button:focus {
  background: var(--accent);
  color: #18191a;
}

/* .js-only and .no-js-only logic */
.no-js .js-only {
  display: none !important;
}
.js .js-only {
  display: block !important;
}
.js .no-js-only {
  display: none !important;
}
.no-js .no-js-only {
  display: block !important;
}

/* Responsive Design */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
    width: 100vw;
    margin: 0;
    border-radius: 0;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    min-width: 0;
    width: 100vw;
  }
  .main-content-area {
    padding: 1.5rem 1rem;
  }
  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    height: auto;
    padding: 0 0.5rem;
  }
  .footer-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 0.5rem;
  }
}
@media (max-width: 600px) {
  .app-container {
    display: block !important;
    height: auto !important;
  }
  .sidebar {
    height: 40vh !important;
    min-height: 0 !important;
    max-height: 40vh !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  .main-content-area {
    max-height: calc(100vh - var(--header-height) - 48px);
    overflow-y: auto !important;
    width: 100vw;
    padding: 1.5rem 1rem;
  }
  .header-content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    padding: 0 0.5rem;
    height: 48px;
    position: relative;
  }
  .logo-link {
    order: 1;
    margin-right: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }
  .logo {
    width: 60px;
    height: 28px;
    margin-right: 0;
  }
  .hamburger {
    order: 3;
    margin-left: auto;
    margin-right: 0;
    position: static;
    width: 28px;
    height: 28px;
    box-shadow: none;
    border-radius: 0;
    background: none !important;
    padding: 0;
  }
  .hamburger span {
    width: 18px;
    height: 2px;
    margin: 3px 0;
    background: #444;
    border-radius: 1.5px;
    transition: 0.3s;
    box-shadow: none;
  }
  .hamburger:focus,
  .hamburger:active,
  .hamburger:hover {
    outline: 2px solid transparent;
    outline-offset: 0;
    background: none !important;
    box-shadow: none;
    border: none;
    transform: none;
  }
  .header-nav {
    display: none;
    position: absolute;
    top: 48px;
    right: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    background: var(--input-bg);
    z-index: 200;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    border-bottom-left-radius: 1.2rem;
    border-bottom-right-radius: 1.2rem;
    overflow-x: hidden;
    padding-bottom: 0.5rem;
  }
  .header-nav.open {
    display: block;
  }
  .header-nav ul {
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.3rem 0.2rem;
    margin: 0;
    width: 100vw;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .header-nav ul li {
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .header-nav ul li a {
    display: block;
    width: 100%;
    padding: 0.6em 1em;
    border-radius: 0.7rem;
    font-size: 1rem;
    font-weight: 500;
    margin: 0.1em 0;
    box-sizing: border-box;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-nav ul li a[aria-current="page"],
  .header-nav ul li a:focus {
    background: var(--accent);
    color: var(--primary);
    outline: 2px solid var(--primary);
    outline-offset: 1.5px;
  }
  html,
  body,
  .center-flex,
  .app-container {
    overflow-x: hidden !important;
    max-width: 100vw;
  }
  .app-container {
    margin-top: 0;
    border-radius: 0;
  }
  footer {
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    min-height: 32px;
    line-height: 1.2;
  }
  .footer-info,
  .footer-credits {
    gap: 0.1rem;
    font-size: 0.85rem;
    padding: 0;
    margin: 0;
  }
  #static-links-container section {
    margin-bottom: 0.7rem;
  }
  #static-links-container h3 {
    font-size: 0.98rem;
    margin-bottom: 0.2rem;
  }
  #static-links-container ul {
    padding-left: 0.2em;
  }
  #static-links-container li {
    margin-bottom: 0.2em;
  }
  #static-links-container a {
    font-size: 0.97rem;
    padding: 0.12em 0.2em;
  }
  .sidebar {
    /* max-height: 45vh; */
    overflow-y: auto;
    padding: 0 !important;
  }
  body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  .main-content-area {
    overflow-y: auto !important;
  }
}
@media (max-width: 480px) {
  .header-content {
    padding: 0 0.2rem;
  }
  .sidebar {
    width: 102vw;
    max-width: 102vw;
    padding: 0 !important;
    /* max-height: 20vh; */
    overflow-y: auto;
  }
  .main-content-area {
    padding: 0.5rem 0.1rem;
  }
  .content-section,
  .app-section {
    padding: 0.3rem 0.1rem;
  }
  .faq-card {
    padding: 0.5rem 0.2rem;
    font-size: 0.97rem;
  }
  #add-link-form {
    padding: 0.5rem 0.1rem 0.5rem 0.1rem;
  }
  #static-links-container section {
    margin-bottom: 0.4rem;
  }
  #static-links-container h3 {
    font-size: 0.93rem;
    margin-bottom: 0.1rem;
  }
  #static-links-container ul {
    padding-left: 0.1em;
  }
  #static-links-container li {
    margin-bottom: 0.12em;
  }
  #static-links-container a {
    font-size: 0.93rem;
    padding: 0.08em 0.1em;
  }
}

/* Dark Theme */
body.dark-theme {
  --bg-color: #18191a;
  --input-bg: #23272f;
  --text-color: #f7f7f8;
  --primary: #f7f7f8;
  --secondary: #23272f;
  --accent: #35363a;
  --border-color: #5a5b60;
  --border-highlight: #6a6b70;
  --focus-outline: 2.5px solid #bdbdbd;
  --skip-link-bg: #bdbdbd;
  --skip-link-color: #23272f;
}
body.dark-theme .header-nav a[aria-current="page"],
body.dark-theme .header-nav a:focus {
  background: var(--accent);
  color: var(--text-color);
}
body.dark-theme .app-section {
  background: #23272f;
  border: 1.5px solid var(--border-highlight);
  color: #f7f7f8;
}
body.dark-theme .faq-card {
  background: #23272f;
  color: var(--text-color);
  border: 1.5px solid var(--border-highlight);
}
body.dark-theme .content-section {
  background: #23272f;
  border: 1.5px solid var(--border-highlight);
  color: #f7f7f8;
}
body.dark-theme .sidebar {
  background: #23272f;
  border-right: 1.5px solid var(--border-highlight);
  color: #f7f7f8;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}
body.dark-theme footer {
  background: #23272f;
  color: #f7f7f8;
  border-top: 1.5px solid var(--border-highlight);
  overflow-x: hidden;
}
body.dark-theme .footer-credits {
  color: #f7f7f8;
}
body.dark-theme button,
body.dark-theme input[type="submit"] {
  background: #f7f7f8;
  color: #23272f;
  border: none;
}
body.dark-theme button:disabled,
body.dark-theme input[type="submit"]:disabled {
  background: #bdbdbd;
  color: #23272f;
  opacity: 0.7;
}
body.dark-theme button:hover:not(:disabled),
body.dark-theme button:focus:not(:disabled) {
  background: #bdbdbd;
  color: #23272f;
}
body.dark-theme #static-links-container {
  background: #23272f;
}
body.dark-theme .collapsible-category {
  background: #23272f;
  border: 1.5px solid #35363a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
body.dark-theme .collapsible-header {
  background: #23272f;
  color: #f7f7f8;
}
body.dark-theme .collapsible-header:focus {
  background: #35363a;
}
body.dark-theme .collapsible-header .arrow {
  color: #bdbdbd;
}

/* Hide scrollbars for sidebar on webkit */
.sidebar::-webkit-scrollbar {
  width: 8px;
  background: var(--secondary);
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* Utility */
[tabindex="-1"]:focus {
  outline: none !important;
}

/* Collapsible categories */
.collapsible-category {
  border-radius: var(--radius);
  margin-bottom: 1.2rem;
  background: var(--secondary);
  box-shadow: none;
  border: 1px solid var(--border-highlight);
}
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 400;
  padding: 0.5em 0.7em 0.5em 0.5em;
  background: none;
  border: none;
  color: var(--text-color);
  border-radius: var(--radius);
  transition: background 0.2s;
  letter-spacing: 0.01em;
  text-align: left;
}
.collapsible-header:focus {
  outline: var(--focus-outline);
  background: var(--accent);
}
.collapsible-header .arrow {
  font-size: 1em;
  font-weight: 300;
  margin-left: 1em;
  margin-right: 0;
  transition: transform 0.2s;
  text-align: right;
}
.collapsible-category.collapsed .collapsible-header .arrow {
  transform: rotate(-90deg);
}
.collapsible-content {
  padding: 0.5em 1em 1em 1.5em;
  display: block;
}
.collapsible-category.collapsed .collapsible-content {
  display: none;
}

/* FAQ cards */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 2rem 0;
}
.faq-card {
  background: var(--secondary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-highlight);
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.faq-card h4 {
  margin: 0 0 0.3em 0;
  font-size: 1.08rem;
  font-weight: 500;
}
.faq-card p {
  margin: 0;
  font-size: 0.98rem;
}

/* Bonus: Enhanced link add form */
#js-features .app-section {
  margin-bottom: 2rem;
}
#add-link-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  background: var(--input-bg);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  border: 1.5px solid var(--border-highlight);
  padding: 2rem 2rem 1.5rem 2rem;
  margin-bottom: 2rem;
  position: relative;
}
#add-link-form h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
#add-link-form h3::before {
  content: "📌";
  font-size: 1.2em;
  margin-right: 0.3em;
  color: #e57300;
}
#add-link-form .add-link-row {
  display: flex;
  flex-direction: row;
  gap: 1.2rem;
  align-items: flex-end;
  width: 100%;
}
#add-link-form label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4em;
  font-weight: 500;
  margin-bottom: 0;
  flex: 1 1 0;
  min-width: 120px;
}
#add-link-form input[type="text"],
#add-link-form input[type="url"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-right: 0;
  padding: 0.7em 1em;
  border-radius: var(--radius);
  border: 1.5px solid var(--border-highlight);
  background: var(--input-bg);
  color: var(--text-color);
  font-size: 1rem;
  height: 2.7em;
  box-sizing: border-box;
}
#add-link-form button[type="submit"] {
  margin-left: 0;
  margin-top: 1.2em;
  padding: 0.7em 2.2em;
  font-size: 1.08rem;
  font-weight: 700;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: background 0.18s, color 0.18s;
  height: 2.7em;
  align-self: flex-end;
}
#add-link-form button[type="submit"]:hover,
#add-link-form button[type="submit"]:focus {
  background: var(--accent);
  color: var(--text-color);
}
body.dark-theme #add-link-form {
  background: #23272f;
  border: 1.5px solid var(--border-highlight);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
body.dark-theme #add-link-form input[type="text"],
body.dark-theme #add-link-form input[type="url"] {
  background: #18191a;
  color: #f7f7f8;
  border: 1.5px solid #35363a;
}
body.dark-theme #add-link-form button[type="submit"] {
  background: #f7f7f8;
  color: #23272f;
}
body.dark-theme #add-link-form button[type="submit"]:hover,
body.dark-theme #add-link-form button[type="submit"]:focus {
  background: #bdbdbd;
  color: #23272f;
}

@media (max-width: 900px) {
  #add-link-form .add-link-row {
    flex-direction: column;
    gap: 0.8rem;
    align-items: stretch;
  }
  #add-link-form button[type="submit"] {
    width: 100%;
    margin-top: 0.5em;
    align-self: stretch;
  }
}

.hamburger {
  display: none;
}
@media (max-width: 600px) {
  #theme-toggle-btn,
  .js-only #theme-toggle-btn {
    display: none !important;
  }
  .hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: none !important;
    border: none;
    cursor: pointer;
    z-index: 201;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    outline: none;
    transition: transform 0.15s;
  }
  .hamburger:focus,
  .hamburger:active,
  .hamburger:hover {
    outline: 2px solid transparent;
    outline-offset: 0;
    background: none !important;
    box-shadow: none;
    border: none;
    transform: none;
  }
  .hamburger span {
    display: block;
    width: 26px;
    height: 3.5px;
    margin: 5px 0;
    background: var(--primary);
    border-radius: 2.5px;
    transition: 0.3s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body,
  .app-container,
  .main-content-area,
  .sidebar,
  header,
  footer {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    border: none !important;
  }
  .sidebar,
  .js-only,
  .no-js-only,
  .header-nav,
  #theme-toggle-btn,
  .footer-info,
  .footer-credits {
    display: none !important;
  }
  .main-content-area,
  .content-section,
  .app-section {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #18191a;
    --input-bg: #23272f;
    --text-color: #f7f7f8;
    --primary: #f7f7f8;
    --secondary: #23272f;
    --accent: #35363a;
    --border-color: #5a5b60;
    --border-highlight: #6a6b70;
    --focus-outline: 2.5px solid #bdbdbd;
    --skip-link-bg: #bdbdbd;
    --skip-link-color: #23272f;
  }
}

.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 20;
  border-radius: 0 0.75rem 0.75rem 0;
}
.sidebar-resize-handle:focus {
  outline: 2.5px solid #23272f;
  background: var(--accent);
}
@media (max-width: 600px) {
  .sidebar-resize-handle {
    display: none !important;
  }
}

/* SUPPRESSION des scrolls globaux à la fin du fichier */
/* .app-container, .main-content-area, .sidebar { overflow: auto; } */
/* html, body { overflow: auto; } */
