/* =============================================
   Notes App - Dark Theme Only
   Cross-browser compatible (Chrome, Firefox,
   Edge, Brave, Safari)
   ============================================= */

/* --- Reset & Box Model --- */
*,
*::before,
*::after {
  -webkit-box-sizing: border-box;
          box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- Base --- */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
      -ms-text-size-adjust: 100%;
}

body {
  background-color: #1a1a1a;
  color: #e0e0e0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: start;
      -ms-flex-align: start;
          align-items: flex-start;
  -webkit-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
  padding: 40px 16px;
}

/* --- App Wrapper --- */
.app-wrapper {
  width: 100%;
  max-width: 860px;
}

/* --- Card --- */
.card {
  background-color: #2b2b2b;
  border-radius: 14px;
  padding: 32px 32px 36px;
  -webkit-box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
          box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* --- Header --- */
.header {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  margin-bottom: 28px;
}

.header-title {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  gap: 14px;
}

.header-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
}

/* --- Input Row --- */
.input-row {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 12px;
  -webkit-box-align: stretch;
      -ms-flex-align: stretch;
          align-items: stretch;
  margin-bottom: 24px;
}

#noteInput {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  background-color: #3a3a3a;
  border: 1.5px solid #4a4a4a;
  border-radius: 8px;
  color: #e0e0e0;
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  resize: vertical;
  outline: none;
  -webkit-transition: border-color 0.2s;
          transition: border-color 0.2s;
  /* Safari fix */
  -webkit-appearance: none;
          appearance: none;
}

#noteInput:focus {
  border-color: #5a9e6f;
}

#noteInput::-webkit-input-placeholder { color: #777; }
#noteInput::-moz-placeholder          { color: #777; opacity: 1; }
#noteInput:-ms-input-placeholder      { color: #777; }
#noteInput::placeholder                { color: #777; }

#addBtn {
  -ms-flex-negative: 0;
      flex-shrink: 0;
  background-color: #3a8f52;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 26px;
  -webkit-transition: background-color 0.2s, -webkit-transform 0.1s;
          transition: background-color 0.2s, transform 0.1s;
  white-space: nowrap;
  /* Safari fix */
  -webkit-appearance: none;
          appearance: none;
}

#addBtn:hover  { background-color: #46a862; }
#addBtn:active { -webkit-transform: scale(0.97); transform: scale(0.97); }

/* --- Notes List --- */
#notesList {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  gap: 12px;
}

/* --- Note Item --- */
.note-item {
  background-color: #3a3a3a;
  border: 1.5px solid #4d4d4d;
  border-radius: 10px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  gap: 10px;
  padding: 14px 16px;
  -webkit-transition: border-color 0.2s;
          transition: border-color 0.2s;
}

.note-item:hover {
  border-color: #666;
}

/* --- Reorder Buttons --- */
.reorder-col {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
  gap: 4px;
  -ms-flex-negative: 0;
      flex-shrink: 0;
}

.btn-move {
  background-color: #4a4a4a;
  border: none;
  border-radius: 5px;
  color: #bbb;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 4px 7px;
  -webkit-transition: background-color 0.15s, color 0.15s;
          transition: background-color 0.15s, color 0.15s;
  /* Safari fix */
  -webkit-appearance: none;
          appearance: none;
}

.btn-move:hover  { background-color: #5a5a5a; color: #fff; }
.btn-move:active { background-color: #666; }
.btn-move:disabled { opacity: 0.25; cursor: default; }

/* --- Note Text (see Strikethrough section below) --- */

/* --- Inline Edit Textarea --- */
.note-edit-area {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  background-color: #2b2b2b;
  border: 1.5px solid #5a9e6f;
  border-radius: 6px;
  color: #e0e0e0;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  padding: 8px 10px;
  resize: vertical;
  outline: none;
  min-width: 0;
  /* Safari fix */
  -webkit-appearance: none;
          appearance: none;
}

/* --- Action Buttons --- */
.note-actions {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  gap: 8px;
  -ms-flex-negative: 0;
      flex-shrink: 0;
}

.btn-edit,
.btn-save,
.btn-cancel,
.btn-delete {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 7px 16px;
  -webkit-transition: background-color 0.2s, -webkit-transform 0.1s;
          transition: background-color 0.2s, transform 0.1s;
  white-space: nowrap;
  /* Safari fix */
  -webkit-appearance: none;
          appearance: none;
}

.btn-edit   { background-color: #c0392b; color: #fff; }
.btn-edit:hover { background-color: #d44637; }

.btn-save   { background-color: #3a8f52; color: #fff; }
.btn-save:hover { background-color: #46a862; }

.btn-cancel { background-color: #555; color: #ddd; }
.btn-cancel:hover { background-color: #666; }

.btn-delete { background-color: #c0392b; color: #fff; }
.btn-delete:hover { background-color: #d44637; }

.btn-edit:active,
.btn-save:active,
.btn-cancel:active,
.btn-delete:active {
  -webkit-transform: scale(0.96);
          transform: scale(0.96);
}

/* --- Strikethrough / Done State --- */
.note-text {
  -webkit-box-flex: 1;
      -ms-flex: 1 1 auto;
          flex: 1 1 auto;
  color: #e0e0e0;
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 0;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}

.note-text:hover {
  opacity: 0.8;
}

.note-done {
  -webkit-text-decoration: line-through;
          text-decoration: line-through;
  color: #888;
}

.note-item-done {
  border-color: #444;
  opacity: 0.75;
}

/* --- Clear Completed Button --- */
.btn-clear-completed {
  display: block;
  width: 100%;
  margin-top: 18px;
  background-color: #5a3030;
  border: 1.5px solid #7a3e3e;
  border-radius: 8px;
  color: #f0a0a0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 11px 20px;
  text-align: center;
  -webkit-transition: background-color 0.2s, border-color 0.2s, -webkit-transform 0.1s;
          transition: background-color 0.2s, border-color 0.2s, transform 0.1s;
  -webkit-appearance: none;
          appearance: none;
}

.btn-clear-completed:hover {
  background-color: #6e3535;
  border-color: #9a4e4e;
  color: #ffbbbb;
}

.btn-clear-completed:active {
  -webkit-transform: scale(0.98);
          transform: scale(0.98);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  padding: 24px 0 8px;
}

/* --- Responsive --- */
@media (max-width: 520px) {
  .card {
    padding: 20px 16px 24px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .input-row {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
        -ms-flex-direction: column;
            flex-direction: column;
  }

  #addBtn {
    width: 100%;
    padding: 12px;
  }

  .note-item {
    -ms-flex-wrap: wrap;
        flex-wrap: wrap;
  }

  .note-actions {
    width: 100%;
    -webkit-box-pack: end;
        -ms-flex-pack: end;
            justify-content: flex-end;
  }
}
