/* ==========================================================================
   SYSTEM BLOCKNOTES - MAIN CSS (VANILLA CSS WITH HSL THEME VARIABLES)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #0b0f19;
  color: #f1f5f9;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

a {
  color: var(--secCol14, #38bdf8);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--secCol18, #bae6fd);
}

/* --- HEADER & NAVIGATION --- */
.navbar-header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.nav-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.35rem;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.brand-logo .logo-icon {
  font-size: 1.6rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  list-style: none;
}

.main-nav a {
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.main-nav a:hover,
.main-nav a.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.admin-link {
  color: var(--thiCol15, #c084fc) !important;
  background: rgba(192, 132, 252, 0.1) !important;
  border: 1px solid rgba(192, 132, 252, 0.25);
}

.admin-link:hover,
.admin-link.active {
  background: rgba(192, 132, 252, 0.25) !important;
  color: #ffffff !important;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.badge-admin {
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.3);
  color: #fde047;
}

.nav-logout-btn {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

.nav-logout-btn:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
}

/* --- MAIN WRAPPER & FOOTER --- */
.main-wrapper {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
}

.main-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #090d16;
  padding: 1.5rem 0;
  margin-top: auto;
  color: #64748b;
  font-size: 0.85rem;
  text-align: center;
}

.footer-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

/* --- PAGE HEADERS & CARDS --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-title-group h1 {
  font-size: 1.85rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.3rem;
}

.page-title-group p {
  color: #94a3b8;
  font-size: 0.95rem;
}

.card {
  background: #131b2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  border-radius: 6px;
}

.btn-primary {
  background: var(--priCol10, #22c55e);
  color: #042f13;
}

.btn-primary:hover {
  background: var(--priCol12, #4ade80);
  color: #042f13;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.4);
}

.btn-secondary {
  background: var(--secCol8, #0284c7);
  color: #ffffff;
}

.btn-secondary:hover {
  background: var(--secCol10, #0ea5e9);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(14, 165, 233, 0.4);
}

.btn-dark {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-dark:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #ef4444;
  color: #ffffff;
}

/* --- BLOCKNOTE GRID & CARDS --- */
.blocknotes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.blocknote-card {
  background: #131b2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.blocknote-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
}

.blocknote-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.blocknote-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
}

.blocknote-owner-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  background: rgba(14, 165, 233, 0.15);
  color: #7dd3fc;
  border: 1px solid rgba(14, 165, 233, 0.3);
  white-space: nowrap;
}

.blocknote-card-body {
  font-size: 0.9rem;
  color: #94a3b8;
  flex: 1;
}

.blocknote-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: #64748b;
}

.blocknote-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* --- VIEW BLOCKNOTE DETAILED NOTE BLOCKS --- */
.notes-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.note-block {
  background: #131b2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  transition: all 0.25s ease;
}

.note-header {
  background: rgba(255, 255, 255, 0.03);
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.note-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.note-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.collapse-icon {
  font-size: 0.85rem;
  color: var(--secCol14, #38bdf8);
  transition: transform 0.25s ease;
  display: inline-block;
}

.note-block.collapsed .collapse-icon {
  transform: rotate(0deg);
}

.note-block:not(.collapsed) .collapse-icon {
  transform: rotate(90deg);
}

.subnote-count-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.note-block.collapsed .note-header {
  border-bottom: none;
}

.note-block.collapsed .note-body {
  display: none;
}

.note-description-box {
  padding: 1rem 1.5rem 0.5rem 1.5rem;
  font-size: 0.92rem;
  color: #94a3b8;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.note-title-area h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0;
}

.note-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.subnotes-list {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.subnote-card {
  background: #1a243a;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 1.25rem;
  position: relative;
}

.subnote-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.subnote-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.subnote-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f1f5f9;
}

.type-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.type-badge.text {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
}

.type-badge.command {
  background: rgba(234, 179, 8, 0.15);
  color: #fde047;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.subnote-content-text {
  font-size: 0.95rem;
  color: #cbd5e1;
  white-space: pre-wrap;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border-left: 3px solid var(--secCol10, #0ea5e9);
}

/* --- COMMAND BLOCK WITH COPY BUTTON --- */
.command-block-wrapper {
  position: relative;
  background: #050811;
  border: 1px solid rgba(234, 179, 8, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(234, 179, 8, 0.03);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.command-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(234, 179, 8, 0.12);
  padding: 0.45rem 0.9rem;
  border-bottom: 1px solid rgba(234, 179, 8, 0.2);
  font-size: 0.8rem;
  font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
  color: #fde047;
  font-weight: 600;
}

.command-badge-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  letter-spacing: 0.3px;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: #eab308;
  color: #000000;
  border-color: #eab308;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.4);
}

.copy-btn.copied {
  background: #22c55e !important;
  color: #042f13 !important;
  border-color: #22c55e !important;
}

.command-content-code {
  font-family: 'Fira Code', 'Cascadia Code', 'Monaco', 'Consolas', monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #4ade80;
  background: #03060d;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 320px;
  white-space: pre;
  margin: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.6);
}

.command-content-code code {
  font-family: inherit;
  color: inherit;
}

/* --- FORMS & INPUTS --- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--secCol10, #0ea5e9);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  cursor: pointer;
}

/* --- MODAL --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #131b2e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-backdrop.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #ffffff;
}

/* --- ALERTS & NOTIFICATIONS --- */
.alert {
  padding: 0.9rem 1.2rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.alert-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* --- TABLES (ADMIN) --- */
.table-responsive {
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.custom-table th {
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* --- COLOR PICKER PREVIEW --- */
.color-preview-box {
  height: 60px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0f172a;
  margin-top: 0.5rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background: #131b2e;
  border: 1px border-dash rgba(255, 255, 255, 0.1);
  border-radius: 16px;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.empty-state h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: #94a3b8;
  max-width: 400px;
  margin: 0 auto 1.5rem auto;
}
