/* Contact Manager — Kiro-style minimal design */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --black: #0D0D0D;
  --violet: #7C3AED;
  --violet-hover: #6D28D9;
  --white: #FFFFFF;
  --gray-light: #F5F5F5;
  --gray-border: #E5E5E5;
  --gray-text: #6B7280;
  --red: #DC2626;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--white);
  color: var(--black);
  line-height: 1.5;
  min-height: 100vh;
}

/* ---------- Login ---------- */
.login-screen {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-screen:not([hidden]) {
  display: flex;
}

.login-box {
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 2rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ---------- Inputs & Buttons ---------- */
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  border: 1px solid var(--gray-border);
  border-radius: 8px;
  background: var(--white);
  color: var(--black);
  outline: none;
  transition: border-color 0.2s;
}

.input:focus {
  border-color: var(--violet);
}

textarea.input {
  resize: vertical;
}

.btn {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary {
  background: var(--violet);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--violet-hover);
}

.btn-secondary {
  background: var(--gray-light);
  color: var(--black);
}

.btn-secondary:hover {
  background: var(--gray-border);
}

.btn-edit {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.btn-edit:hover {
  background: var(--gray-light);
}

/* ---------- Error / Empty messages ---------- */
.error-msg {
  color: var(--red);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.empty-msg {
  text-align: center;
  color: var(--gray-text);
  padding: 3rem 1rem;
  font-size: 1rem;
}

/* ---------- Contacts View ---------- */
.contacts-view {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

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

.contacts-title {
  font-size: 1.5rem;
  font-weight: 600;
}

/* ---------- Table ---------- */
.table-wrapper {
  overflow-x: auto;
}

.contacts-table {
  width: 100%;
  border-collapse: collapse;
}

.contacts-table th,
.contacts-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-border);
  font-size: 0.9rem;
  white-space: nowrap;
}

.contacts-table th {
  font-weight: 600;
  color: var(--gray-text);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.contacts-table td.notes-cell {
  white-space: normal;
  max-width: 180px;
  word-break: break-word;
}

.contacts-table tbody tr:hover {
  background: var(--gray-light);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 13, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}

.modal-overlay:not([hidden]) {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contact-form label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-text);
  margin-top: 0.5rem;
}

.notes-counter {
  font-weight: 400;
  font-size: 0.8rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .contacts-view {
    padding: 1rem;
  }

  .contacts-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .contacts-table th,
  .contacts-table td {
    padding: 0.5rem 0.5rem;
    font-size: 0.8rem;
  }

  .modal {
    padding: 1.5rem;
  }
}
