/* ============================================
   Notes App - Estilo Google Keep
   ============================================ */

/* Global font definition */
.notes-title,
.notes-intro {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* Title & intro */
.notes-title {  
  font-size: clamp(1.8rem, 3vw, 2.4rem);  
  letter-spacing: -.5px;  
  margin: 0 0 .75rem;  
  font-weight: 600;
}

.notes-intro {  
  margin-top: 0;  
  margin-bottom: 1.75rem;  
  font-size: .95rem;  
  color: #6b7280;  
  max-width: 62ch;  
}

body.dark-mode .notes-intro {  
  color: #b4b4b4;  
}

/* Dark Mode (padrão quando body.dark-mode está ativo) */
body.dark-mode #notes-app-content {
  background: linear-gradient(135deg, #1a1a1a 0%, #242424 100%);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Light Mode */
#notes-app-content {
  background: linear-gradient(135deg, #fef6e4 0%, #fffbf0 100%);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ===== CONTAINER ===== */
.notes-container {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

/* Nova Nota Form */
.new-note-form {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.2s;
  border: 1px solid #e5e5ea;
}

.new-note-form:focus-within {
  box-shadow: 0 4px 16px rgba(0, 113, 227, 0.15);
  border-color: rgba(0, 113, 227, 0.3);
}

body.dark-mode .new-note-form {
  background: #2a2a2a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(1, 230, 205, 0.1);
}

body.dark-mode .new-note-form:focus-within {
  box-shadow: 0 4px 16px rgba(1, 230, 205, 0.2);
  border-color: rgba(1, 230, 205, 0.3);
}

.new-note-form input,
.new-note-form textarea {
  width: 100%;
  border: none;
  outline: none;
  font-family: 'Roboto', sans-serif;
  resize: none;
}

.new-note-form input {
  font-size: 16px;
  font-weight: 600;
  padding: 8px 0;
  margin-bottom: 8px;
  color: #1d1d1f;
  background: transparent;
}

.new-note-form input::placeholder {
  color: #999;
}

.new-note-form textarea {
  font-size: 14px;
  min-height: 60px;
  padding: 8px 0;
  color: #333;
  line-height: 1.5;
  background: transparent;
}

.new-note-form textarea::placeholder {
  color: #999;
}

body.dark-mode .new-note-form input {
  color: #e2e2e2;
}

body.dark-mode .new-note-form input::placeholder {
  color: #888;
}

body.dark-mode .new-note-form textarea {
  color: #d1d1d1;
}

body.dark-mode .new-note-form textarea::placeholder {
  color: #888;
}

.note-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

body.dark-mode .note-form-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.note-form-actions button {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add-note {
  background: #0071e3;
  color: #ffffff;
}

.btn-add-note:hover {
  background: #0077ed;
  transform: translateY(-1px);
}

.btn-cancel-note {
  background: #e5e5ea;
  color: #1d1d1f;
}

.btn-cancel-note:hover {
  background: #d2d2d7;
}

body.dark-mode .btn-add-note {
  background: #01e6cd;
  color: #1e1e1e;
}

body.dark-mode .btn-add-note:hover {
  background: #00d1ba;
}

body.dark-mode .btn-cancel-note {
  background: #3a3a3a;
  color: #d1d1d1;
}

body.dark-mode .btn-cancel-note:hover {
  background: #4a4a4a;
}

/* Grid de Notas */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

/* Nota Individual */
.note-card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  border-left: 4px solid;
  min-height: 120px;
  display: flex;
  flex-direction: column;
}

.note-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

body.dark-mode .note-card {
  background: #2a2a2a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode .note-card:hover {
  box-shadow: 0 4px 16px rgba(1, 230, 205, 0.15);
}

/* Cores das notas - Light Mode */
.note-card[data-color="yellow"] {
  border-left-color: #fbbf24;
  background: #fef3c7;
}

.note-card[data-color="blue"] {
  border-left-color: #60a5fa;
  background: #dbeafe;
}

.note-card[data-color="green"] {
  border-left-color: #34d399;
  background: #d1fae5;
}

.note-card[data-color="pink"] {
  border-left-color: #f472b6;
  background: #fce7f3;
}

.note-card[data-color="purple"] {
  border-left-color: #a78bfa;
  background: #ede9fe;
}

.note-card[data-color="default"] {
  border-left-color: #0071e3;
  background: white;
}

/* Cores das notas - Dark Mode */
body.dark-mode .note-card[data-color="yellow"] {
  border-left-color: #fbbf24;
  background: linear-gradient(135deg, #3a3520 0%, #2d2a1a 100%);
}

body.dark-mode .note-card[data-color="blue"] {
  border-left-color: #60a5fa;
  background: linear-gradient(135deg, #1e2a3a 0%, #1a2230 100%);
}

body.dark-mode .note-card[data-color="green"] {
  border-left-color: #34d399;
  background: linear-gradient(135deg, #1e3a2f 0%, #1a2d25 100%);
}

body.dark-mode .note-card[data-color="pink"] {
  border-left-color: #f472b6;
  background: linear-gradient(135deg, #3a1e30 0%, #2d1a25 100%);
}

body.dark-mode .note-card[data-color="purple"] {
  border-left-color: #a78bfa;
  background: linear-gradient(135deg, #2a1e3a 0%, #221a2d 100%);
}

body.dark-mode .note-card[data-color="default"] {
  border-left-color: #01e6cd;
  background: #2a2a2a;
}

.note-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #1d1d1f;
  margin-bottom: 8px;
  word-break: break-word;
}

.note-card-content {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
  margin-bottom: 12px;
}

body.dark-mode .note-card-title {
  color: #e2e2e2;
}

body.dark-mode .note-card-content {
  color: #b8b8b8;
}

.note-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.note-card-date {
  font-size: 11px;
  color: #9ca3af;
}

body.dark-mode .note-card-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .note-card-date {
  color: #808080;
}

.note-card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.note-card:hover .note-card-actions {
  opacity: 1;
}

.note-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.note-action-btn .material-icons {
  font-size: 18px;
  color: #6b7280;
}

.note-action-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.note-action-btn.delete:hover .material-icons {
  color: #ef4444;
}

body.dark-mode .note-action-btn .material-icons {
  color: #a0a0a0;
}

body.dark-mode .note-action-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .note-action-btn.delete:hover .material-icons {
  color: #ff6b6b;
}

/* Modal de Edição */
.note-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

body.dark-mode .note-modal {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.note-modal.active {
  display: flex;
}

.note-modal-content {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  position: relative;
  border: 1px solid #e5e5ea;
}

body.dark-mode .note-modal-content {
  background: #2a2a2a;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(1, 230, 205, 0.2);
}

.note-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.note-modal-header h3 {
  margin: 0;
  font-size: 20px;
  color: #1d1d1f;
}

body.dark-mode .note-modal-header h3 {
  color: #e2e2e2;
}

.note-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.note-modal-close:hover {
  background: #f5f5f7;
}

.note-modal-close .material-icons {
  font-size: 24px;
  color: #6b7280;
}

body.dark-mode .note-modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .note-modal-close .material-icons {
  color: #a0a0a0;
}

.note-modal-body input,
.note-modal-body textarea {
  width: 100%;
  border: 1px solid #d2d2d7;
  border-radius: 6px;
  padding: 12px;
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border 0.2s;
  background: #f5f5f7;
  color: #1d1d1f;
}

.note-modal-body input {
  font-weight: 600;
  font-size: 16px;
}

.note-modal-body input:focus,
.note-modal-body textarea:focus {
  border-color: #0071e3;
  background: #ffffff;
}

body.dark-mode .note-modal-body input,
body.dark-mode .note-modal-body textarea {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #333;
  color: #e2e2e2;
}

body.dark-mode .note-modal-body input:focus,
body.dark-mode .note-modal-body textarea:focus {
  border-color: #01e6cd;
  background: #3a3a3a;
}

.note-modal-body textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.5;
}

.note-color-picker {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  background: #f5f5f7;
  border-radius: 6px;
}

.note-color-picker label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 8px;
}

body.dark-mode .note-color-picker {
  background: #1e1e1e;
}

body.dark-mode .note-color-picker label {
  color: #a0a0a0;
}

.color-option {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border-color: #333;
  transform: scale(1.15);
}

.color-option[data-color="yellow"] {
  background: #fbbf24;
}

.color-option[data-color="blue"] {
  background: #60a5fa;
}

.color-option[data-color="green"] {
  background: #34d399;
}

.color-option[data-color="pink"] {
  background: #f472b6;
}

.color-option[data-color="purple"] {
  background: #a78bfa;
}

.color-option[data-color="default"] {
  background: white;
  border: 2px solid #0071e3;
}

body.dark-mode .color-option[data-color="default"] {
  background: #2a2a2a;
  border: 2px solid #01e6cd;
}

.note-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.note-modal-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-note {
  background: #0071e3;
  color: #ffffff;
}

.btn-save-note:hover {
  background: #0077ed;
}

.btn-cancel-edit {
  background: #e5e5ea;
  color: #1d1d1f;
}

.btn-cancel-edit:hover {
  background: #d2d2d7;
}

body.dark-mode .btn-save-note {
  background: #01e6cd;
  color: #1e1e1e;
}

body.dark-mode .btn-save-note:hover {
  background: #00d1ba;
}

body.dark-mode .btn-cancel-edit {
  background: #3a3a3a;
  color: #d1d1d1;
}

body.dark-mode .btn-cancel-edit:hover {
  background: #4a4a4a;
}

/* Empty State */
.notes-empty {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.notes-empty .material-icons {
  font-size: 64px;
  color: #d1d5db;
  margin-bottom: 16px;
}

.notes-empty p {
  font-size: 16px;
  margin: 0;
}

body.dark-mode .notes-empty {
  color: #808080;
}

body.dark-mode .notes-empty .material-icons {
  color: #4a4a4a;
}

/* Loading State */
.notes-loading {
  text-align: center;
  padding: 40px;
  color: #9ca3af;
}

body.dark-mode .notes-loading {
  color: #808080;
}

.notes-loading .material-icons {
  font-size: 32px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Scrollbar customization */
.notes-container::-webkit-scrollbar {
  width: 8px;
}

.notes-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.notes-container::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

.notes-container::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

body.dark-mode .notes-container::-webkit-scrollbar-track {
  background: #1a1a1a;
}

body.dark-mode .notes-container::-webkit-scrollbar-thumb {
  background: #4a4a4a;
}

body.dark-mode .notes-container::-webkit-scrollbar-thumb:hover {
  background: #5a5a5a;
}

/* Responsividade */
@media (max-width: 768px) {
  .notes-grid {
    grid-template-columns: 1fr;
  }

  .note-modal-content {
    width: 95%;
    padding: 20px;
  }

  .notes-header {
    padding: 16px;
  }

  .notes-container {
    padding: 16px;
  }
}
