/* ========================================
   NOTE CARDS (GRID & LIST LAYOUTS)
   ======================================== */

.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
}

.note-card {
  border: 1px solid #ddd;
  border-radius: 3px;
  background: #fff;
  transition: box-shadow 0.3s ease;
  overflow: hidden;
}

.note-card:hover {
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.note-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 15px;
  border-bottom: 1px solid #f0f0f0;
  gap: 10px;
}

.note-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #4c4c4c;
  margin-bottom: 4px;
  line-height: 1.3;
  word-break: break-word;
}

.note-card-header .note-url {
  font-size: 15px;
  font-weight: 500;
  color: #50ca59;
  text-decoration: none;
  flex: 1;
  word-break: break-word;
}

.note-card-header .note-url:hover {
  color: #3da449;
  text-decoration: underline;
}

.note-card-header .note-badge {
  font-size: 16px;
  color: #f39c12;
  flex-shrink: 0;
}

.note-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  padding: 12px 15px;
  font-size: 14px;
  color: #a4a4a4;
  background: #fafbfc;
}

.note-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.note-card-meta i {
  font-size: 14px;
  line-height: 1;
}

.note-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 15px;
  border-top: 1px solid #f0f0f0;
}

.note-card-actions a {
  font-size: 13px;
  color: #696969;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.note-card-actions a:hover {
  color: #50ca59;
  background: rgba(80, 202, 89, 0.1);
}

.note-card-actions a.delete-action {
  color: #dc3545;
}

.note-card-actions a.delete-action:hover {
  color: #c82333;
  background: rgba(220, 53, 69, 0.1);
}

/* List variant - more compact for tracking pages */
.notes-list .note-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.notes-list .note-card-header {
  flex: 1;
  min-width: 0;
  border-bottom: none;
  border-right: 1px solid #f0f0f0;
}

.notes-list .note-card-meta {
  flex-shrink: 0;
  min-width: 200px;
  border-right: 1px solid #f0f0f0;
  background: transparent;
}

.notes-list .note-card-actions {
  flex-shrink: 0;
  border-top: none;
  justify-content: flex-end;
  align-items: center;
}

/* Mobile responsive cards */
@media only screen and (max-width: 768px) {
  .note-grid {
    grid-template-columns: 1fr;
  }

  .notes-list .note-card {
    flex-direction: column;
  }

  .notes-list .note-card-header {
    border-right: none;
    border-bottom: 1px solid #f0f0f0;
  }

  .notes-list .note-card-meta {
    border-right: none;
    min-width: 0;
    background: #fafbfc;
  }

  .notes-list .note-card-actions {
    justify-content: flex-start;
    border-top: 1px solid #f0f0f0;
  }
}

/* ========================================
   NOTES TABLE STYLES
   ======================================== */

.notes-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  border: none;
  margin-top: 15px;
}

.notes-table th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 14px;
  color: #696969;
  padding: 12px 15px;
  text-align: left;
  border-bottom: 2px solid #ddd;
  vertical-align: middle;
  line-height: 1.4;
}

.notes-table td {
  padding: 12px 15px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  color: #696969;
  vertical-align: middle;
  line-height: 1.4;
}

/* (Reverted) Removed flex centering on table cells to restore native layout */

.notes-table tbody tr:hover {
  background: #f8f9fa;
}

.notes-table tbody tr:last-child td {
  border-bottom: none !important;
}

.notes-table .note-url {
  font-weight: 500;
  color: #50ca59;
  text-decoration: none;
}

.notes-table .note-url:hover {
  color: #3da449;
  text-decoration: underline;
}

.notes-table .note-stats {
  font-size: 14px;
  color: #a4a4a4;
  display: inline-flex;
  align-items: center;
  line-height: 1.4;
  margin: 0 !important;
  padding: 0 !important;
  gap: 0;
}

.notes-table .note-stats i {
  display: inline-block;
  font-size: 14px;
  margin-right: 2px;
  line-height: 1;
  vertical-align: middle;
}

/* Remove flex on table cells to preserve table layout (fix misalignment) */

/* Ensure icons align consistently in status column */
.notes-table .status-col i {
  vertical-align: middle;
  line-height: 1;
}

.notes-table .note-status {
  text-align: center;
  width: 60px;
}

.notes-table .status-col {
  width: 60px;
  text-align: center;
}

/* Column sizing and alignment for better consistency */
.notes-table .note-col {
  width: auto;
}

.notes-table .updated-col {
  width: 140px;
}

.notes-table .visits-col {
  width: 80px;
  text-align: right;
}

/* Modifier: left-align visits column when needed */
.notes-table.visits-left .visits-col {
  text-align: left;
}

.notes-table .actions-col {
  width: 200px;
  text-align: right;
}

.notes-table .note-status i,
.notes-table .status-col i {
  color: #f39c12;
  font-size: 16px;
}

.notes-table .note-actions {
  white-space: nowrap;
}

.notes-table .actions-col {
  white-space: nowrap;
  min-width: 160px;
  text-align: right;
}

.notes-table .note-actions a,
.notes-table .actions-col a {
  font-size: 13px;
  color: #696969;
  text-decoration: none;
  margin-right: 10px;
  padding: 4px 8px;
  border-radius: 2px;
  transition: all 0.2s ease;
}

/* Prevent long note URLs from causing overflow */
.notes-table .note-col .note-url {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notes-table .note-actions a:hover,
.notes-table .actions-col a:hover {
  color: #50ca59;
  background: rgba(80, 202, 89, 0.1);
}

.notes-table .note-actions a.delete-action,
.notes-table .actions-col a.delete-action {
  color: #dc3545;
}

.notes-table .note-actions a.delete-action:hover,
.notes-table .actions-col a.delete-action:hover {
  color: #c82333;
  background: rgba(220, 53, 69, 0.1);
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive .notes-table {
  min-width: 600px;
}

@media only screen and (max-width: 768px) {
  .notes-table {
    border: 0;
    background: transparent;
  }
  
  /* Allow table to shrink on small screens to avoid overflow */
  .table-responsive .notes-table {
    min-width: 0;
  }
  
  .notes-table thead {
    display: none;
  }
  
  .notes-table tbody tr {
    display: block;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    margin-bottom: 10px;
    padding: 15px;
  }
  
  .notes-table tbody tr:hover {
    background: #fff;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
  }
  
  .notes-table tbody td {
    display: block;
    border: none;
    padding: 3px 0;
    text-align: left;
  }
  
  .notes-table tbody td:before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: #696969;
    margin-right: 10px;
  }
  
  .notes-table .note-actions,
  .notes-table .actions-col {
    width: auto;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    margin-top: 8px;
  }
  
  .notes-table .note-actions:before,
  .notes-table .actions-col:before {
    display: none;
  }

  /* Tighten stats layout on mobile */
  .note-card .note-stats,
  .notes-table .note-stats {
    margin: 0 !important;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    line-height: 1.3;
    gap: 0;
  }

  .notes-table .note-stats i {
    margin-right: 2px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
  }

  /* Align mobile labels with values */
  .notes-table tbody td:before {
    display: inline-block;
    vertical-align: middle;
  }

  /* Let long URLs wrap on mobile to prevent overflow */
  .notes-table .note-col .note-url {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Tighten label spacing before values */
  .notes-table .updated-col:before,
  .notes-table .visits-col:before {
    margin-right: 4px;
  }
}

@media only screen and (max-width: 650px) {
  .ql-toolbar.ql-snow {
    display: none;
  }
  .desktop-only {
    display:none;
  }

  .account-wrap {
    margin: 20px auto 0;
    padding: 20px;
  }
  
  .dashboard-container {
    margin: 10px;
    padding: 10px;
  }
  
  .dashboard-nav .nav-links a {
    margin-left: 10px;
    font-size: 12px;
  }
  
  .note-grid {
    grid-template-columns: 1fr;
  }
}

/* Enhanced mobile account nav dropdown */
@media only screen and (max-width: 780px) {
  .dashboard-header { padding: 12px; }
  .dashboard-nav {
    position: relative;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }
  .dashboard-nav .logo { float: none; }
  .dashboard-nav .nav-toggle { display: inline-flex; align-items: center; justify-content: center; margin-left: auto; }
  .dashboard-nav .nav-toggle.is-open { background: #f8f8f8; border-color: #ccc; }

  /* Turn links into a dropdown panel */
  .dashboard-nav .nav-links {
    float: none;
    display: none;
    position: absolute;
    top: 48px;
    right: 0;
    width: 220px;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    padding: 6px 0;
    z-index: 1000;
  }
  .dashboard-nav .nav-links.is-open { display: block; }
  .dashboard-nav .nav-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin: 0;
    font-size: 14px;
    border-bottom: 1px solid #f2f2f2;
  }
  .dashboard-nav .nav-links a:last-child { border-bottom: 0; }
  .dashboard-nav .nav-links a:hover { background: #f9fafb; color: #333; }
}
