/* ===================================
   Base Styles
   =================================== */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  line-height: 1.4;
  background: white;
  color: black;
}

/* ===================================
   Typography
   =================================== */
h1 {
  font-size: 24px;
  font-weight: normal;
  margin-bottom: 10px;
}

h2 {
  font-size: 18px;
  font-weight: normal;
  margin: 0 0 10px 0;
}

h1.list-title {
  font-size: 22px;
  margin-bottom: 15px;
}

/* ===================================
   Links
   =================================== */
a {
  color: #0000EE;
  text-decoration: underline;
  font-family: Arial, sans-serif;
}

a:visited {
  color: #0000EE;
}

a:hover {
  background: #ffffcc;
}

.node-title-link {
  color: #000000;
  text-decoration: underline;
}

.node-title-link:visited {
  color: #000000;
}

.node-title-link:hover {
  background: #ffffcc;
}

.new-note-link {
  color: #95d0fc;
  font-size: 10px;
  text-decoration: none;
  vertical-align: super;
  margin-left: 2px;
  font-weight: bold;
}

.new-note-link:visited {
  color: #95d0fc;
}

.new-note-link:hover {
  background: #ffffcc;
}

/* ===================================
   Forms
   =================================== */
textarea {
  font-family: monospace;
  font-size: 14px;
  width: 600px;
  height: 400px;
  border: 1px solid #000;
  padding: 5px;
}

input[type="text"],
input[type="url"] {
  font-family: Arial, sans-serif;
  font-size: 14px;
  width: 400px;
  padding: 4px;
  border: 1px solid #000;
}

input[type="password"] {
  font-family: Arial, sans-serif;
  font-size: 14px;
  width: 100%;
  max-width: 300px;
  padding: 4px;
  border: 1px solid #000;
  margin-bottom: 20px;
}

input[type="password"]:focus {
  outline: 1px solid #0000EE;
}

button {
  font-family: Arial, sans-serif;
  font-size: 14px;
  padding: 4px 12px;
  background: #ddd;
  border: 1px solid #000;
  cursor: pointer;
  margin-right: 10px;
}

button:hover {
  background: #ccc;
}

button:active {
  background: #bbb;
}

label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: normal;
}

.tag-input-wrapper {
  margin-top: 10px;
  margin-bottom: 10px;
}

.tag-input-wrapper input {
  width: 400px;
}

.ai-tag-btn {
  background: #e8f4f8;
  border: 1px solid #000;
}

.ai-tag-btn:hover {
  background: #d0e8f0;
}

.ai-tag-status {
  margin-left: 10px;
  font-size: 12px;
  color: #666;
}

#draft-status {
  color: #666;
  font-size: 12px;
  margin-left: 20px;
}

/* ===================================
   Lists & Items
   =================================== */
.wrapper {
  max-width: 35em;
  margin: 0;
  padding: 15px 15px 15px 20px;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

li {
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ddd;
}

.preview li {
  border: none;
  margin: 2px 0;
  padding: 0;
}

/* ===================================
   Meta Information
   =================================== */
.meta {
  color: #666;
  font-size: 12px;
  margin: 3px 0;
}

.meta.edit-meta {
  font-size: 14px;
  margin: 10px 0 20px;
}

.timestamp {
  cursor: help;
  border-bottom: 1px dotted #999;
}

/* ===================================
   Preview/Content Areas
   =================================== */
.preview {
  margin-top: 8px;
  font-size: 14px;
}

.preview p {
  margin: 5px 0;
}

.preview h1,
.preview h2,
.preview h3 {
  font-size: 16px;
  margin: 8px 0 5px 0;
  font-weight: normal;
}

.preview pre {
  background: #f5f5f5;
  padding: 8px;
  overflow-x: auto;
  font-size: 12px;
  margin: 5px 0;
}

.preview code {
  background: #f5f5f5;
  padding: 1px 3px;
  font-size: 12px;
}

.preview blockquote {
  border-left: 3px solid #ccc;
  margin: 5px 0;
  padding-left: 10px;
  color: #555;
}

.preview ul,
.preview ol {
  margin: 5px 0;
  padding-left: 20px;
}

.preview.edit-preview {
  border: 1px solid #000;
  padding: 10px;
  margin-top: 20px;
  min-height: 400px;
  overflow: auto;
  line-height: 1.4;
}

.rendered-content {
  line-height: 1.4;
}

.rendered-content pre {
  font-family: monospace;
  background: #f0f0f0;
  padding: 10px;
  overflow-x: auto;
}

.rendered-content code {
  font-family: monospace;
}

.rendered-content table {
  border-collapse: collapse;
  margin: 10px 0;
}

.rendered-content th,
.rendered-content td {
  border: 1px solid #000;
  padding: 5px;
}

.rendered-content h1,
.rendered-content h2,
.rendered-content h3,
.rendered-content h4,
.rendered-content h5,
.rendered-content h6 {
  margin: 10px 0;
}

.rendered-content ul,
.rendered-content ol {
  margin: 10px 0;
  padding-left: 30px;
}

/* ===================================
   Tags
   =================================== */
.tags {
  margin-top: 5px;
  font-size: 11px;
  color: #666;
}

.tag {
  display: inline-block;
  background: #f0f0f0;
  padding: 2px 6px;
  margin-right: 5px;
  border-radius: 3px;
}

/* ===================================
   Node Actions
   =================================== */
.node-actions {
  margin-top: 8px;
}

.node-actions a,
.node-actions button {
  font-size: 12px;
  margin-right: 10px;
  cursor: pointer;
}

.node-actions button {
  background: none;
  border: none;
  padding: 0;
  color: #0000EE;
  text-decoration: underline;
  font-family: Arial, sans-serif;
}

.node-actions button:hover {
  background: #ffffcc;
}

.confirm-box {
  display: inline;
  margin-left: 5px;
  font-size: 12px;
}

.confirm-box button {
  margin-right: 5px;
}

/* ===================================
   Sub-nodes
   =================================== */
.subnodes p {
  font-size: 12px;
  color: #666;
  margin: 8px 0;
}

.subnodes > div {
  margin-left: 20px;
  padding: 5px 0;
  border-left: 2px solid #ddd;
  padding-left: 10px;
}

.subnodes a {
  font-size: 13px;
}

.subnodes div[style*="margin-left"] div {
  font-size: 11px;
  color: #999;
  margin-top: 3px;
}

.children {
  margin: 20px 0;
  padding: 15px;
  background: #f9f9f9;
  border: 1px solid #ddd;
}

.children h2 {
  font-size: 18px;
  font-weight: normal;
  margin: 0 0 10px 0;
}

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

.children li {
  margin: 10px 0;
  padding: 10px;
  background: white;
  border: 1px solid #ddd;
}

.child-preview {
  font-size: 13px;
  color: #666;
  margin-top: 5px;
}

.child-actions {
  margin: 5px 0;
}

.child-actions a {
  font-size: 12px;
  margin-right: 10px;
}

/* ===================================
   Parent Info
   =================================== */
.parent-info {
  color: #666;
  font-size: 14px;
  margin-bottom: 20px;
  padding: 10px;
  background: #f5f5f5;
  border: 1px solid #ddd;
}

/* ===================================
   Tables
   =================================== */
table {
  border: none;
  width: 100%;
}

td {
  vertical-align: top;
  padding-right: 40px;
}

/* ===================================
   Utility Classes
   =================================== */
.hidden {
  display: none;
}

hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 15px 0;
}

hr.edit-hr {
  margin: 20px 0;
}

/* ===================================
   Authentication/PIN Entry Styles
   =================================== */
body.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-container {
  max-width: 400px;
  width: 100%;
  padding: 20px;
}

.auth-container p {
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
}

.auth-container form {
  margin-top: 20px;
}

.alert {
  padding: 10px;
  margin-bottom: 15px;
  font-size: 14px;
  border: 1px solid #000;
}

.alert-error {
  background: #fee;
  color: #000;
}

/* ===================================
   New Link Page Styles
   =================================== */
body.new-link-body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.new-link-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 40px;
  max-width: 600px;
  width: 100%;
}

.new-link-container h1 {
  color: #333;
  margin-bottom: 30px;
  font-size: 28px;
}

.new-link-container label {
  color: #666;
  font-weight: 500;
}

.new-link-container input[type="url"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.new-link-container input[type="url"]:focus {
  outline: none;
  border-color: #667eea;
}

.error-message {
  background: #fee;
  color: #c33;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #c33;
}

.button-group {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.new-link-container button {
  flex: 1;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}

.new-link-container button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.nav-link {
  display: inline-block;
  margin-top: 20px;
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
}

.nav-link:hover {
  text-decoration: underline;
}

.flash-messages {
  margin-bottom: 20px;
}

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.flash.success {
  background: #efe;
  color: #3c3;
  border-left: 4px solid #3c3;
}

/* ===================================
   Responsive Design
   =================================== */

/* @media (max-width: 1100px) */
@media (max-width: 1100px) {
  textarea {
    width: 100%;
    max-width: 600px;
  }

  input[type="text"],
  input[type="url"] {
    width: 100%;
    max-width: 400px;
  }

  .tag-input-wrapper input {
    width: 100%;
    max-width: 400px;
  }

  .preview.edit-preview {
    width: 100%;
    max-width: 600px;
  }
}

/* @media (max-width: 768px) */
@media (max-width: 768px) {
  body {
    margin: 10px;
  }

  .wrapper {
    padding: 10px;
  }

  h1 {
    font-size: 20px;
  }

  h1.list-title {
    font-size: 20px;
  }

  h2 {
    font-size: 16px;
  }

  li {
    margin-bottom: 12px;
    padding-bottom: 10px;
  }

  .preview {
    font-size: 13px;
  }

  .preview pre {
    font-size: 11px;
  }

  textarea {
    width: 100%;
    height: 300px;
    max-width: none;
  }

  input[type="text"],
  input[type="url"] {
    width: 100%;
    max-width: none;
  }

  .tag-input-wrapper input {
    width: calc(100% - 100px);
    max-width: none;
  }

  input[type="password"] {
    max-width: none;
  }

  .preview.edit-preview {
    width: 100%;
    max-width: none;
    min-height: 300px;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
  }

  td {
    padding-right: 0;
    margin-bottom: 30px;
  }

  .auth-container {
    padding: 10px;
  }

  .auth-container h1 {
    font-size: 20px;
  }

  .auth-container input[type="password"] {
    max-width: none;
  }
}
