:root {
  --color-primary: #3498db;
  --color-primary-dark: #2980b9;
  --color-success: #27ae60;
  --color-success-dark: #229954;
  --color-danger: #e74c3c;
  --color-danger-dark: #c0392b;
  --color-secondary: #95a5a6;
  --color-secondary-dark: #7f8c8d;
}

* {
  box-sizing: border-box;
}

html {
  font-family: Arial, sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: 1em;
}

header {
  margin-bottom: 0.75em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1em;
  background: white;
  padding: 0.75em 1.25em;
  border-radius: 50px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;
}

.nav-brand {
  font-size: 1.2em;
  font-weight: bold;
  color: #2c3e50;
  text-decoration: none;
  margin-right: auto;
  transition: color 0.2s ease;
}

.nav-brand:hover {
  color: #3498db;
}

.nav-items {
  display: flex;
  gap: 0.5em;
  align-items: center;
}

.nav-pill {
  padding: 0.5em 1em;
  border-radius: 50px;
  background: #ecf0f1;
  color: #2c3e50;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-pill:hover {
  background: var(--color-primary);
  color: white;
}

.nav-pill.active {
  background: #2c3e50;
  color: white;
}

.main-content {
  flex: 1;
  background: white;
  padding: 0 2em 2em 2em;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;
}

footer {
  padding: 2em;
  text-align: center;
  color: #999;
}

footer p {
  margin: 0;
  font-size: 0.85em;
}

/* Login Form */
.login-form {
  max-width: 400px;
}

.login-form__error {
  color: var(--color-danger);
  padding: 0.75em;
  background: #ffe6e6;
  border-radius: 4px;
  margin-bottom: 1em;
}

.login-form__field {
  margin-bottom: 1em;
}

.login-form__label {
  display: block;
  margin-bottom: 0.25em;
  font-weight: 500;
}

.login-form__input {
  width: 100%;
  padding: 0.5em;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1em;
}

.login-form__button {
  padding: 0.75em 1.5em;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s ease;
}

.login-form__button:hover {
  background: var(--color-primary-dark);
}

/* Address Book List */
.book-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.book-list__item {
  margin-bottom: 1em;
}

.book-list__link {
  display: block;
  padding: 1em;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #ddd;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s;
}

.book-list__link:hover {
  background: #f0f0f0;
}

.book-list__name {
  font-size: 1.2em;
  font-weight: bold;
  color: #2c3e50;
}

.book-list__id {
  color: #999;
  font-size: 0.85em;
  margin-left: 0.5em;
}

.book-list__meta {
  color: #666;
  font-size: 0.9em;
  margin-top: 0.25em;
}

/* Contact List */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.contact-card {
  text-decoration: none;
  color: inherit;
  display: block;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: white;
  transition: all 0.2s ease;
}

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

.contact-card__name {
  font-size: 1.1em;
  font-weight: bold;
  margin-bottom: 0.5em;
}

.contact-card__details {
  color: #666;
  font-size: 0.95em;
}

.contact-card__detail {
  margin-bottom: 0.25em;
}

.contact-card__meta {
  margin-top: 0.5em;
  font-size: 0.9em;
  color: #999;
}

/* Contact Detail Page */
.contact-meta {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5em;
  margin-bottom: 1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5em;
}

.contact-meta__info {
  margin-bottom: 0.5em;
  color: #666;
  font-size: 0.9em;
  flex: 1;
}

.contact-meta__code {
  font-family: monospace;
  font-size: 0.85em;
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
}

.contact-meta__actions {
  flex-shrink: 0;
}

.contact-action-button {
  display: inline-block;
  padding: 0.6em 1.2em;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.contact-action-button--primary {
  background: var(--color-primary);
  color: white;
}

.contact-action-button--primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.contact-action-button--danger {
  background: var(--color-danger);
  color: white;
}

.contact-action-button--danger:hover {
  background: var(--color-danger-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.contact-section {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5em;
  margin-bottom: 1em;
}

.contact-section__title {
  margin-top: 0;
  margin-bottom: 1em;
  font-size: 1.3em;
  color: #2c3e50;
}

.contact-section__item {
  margin-bottom: 0.75em;
}

.contact-section__value {
  font-size: 1.05em;
  margin-bottom: 0.25em;
}

.contact-section__type {
  font-size: 0.85em;
  color: #666;
  margin-top: 0.25em;
}

.contact-section__tag {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 0.5em;
  display: inline-block;
}

.contact-section__note {
  font-size: 0.95em;
  margin-bottom: 0.5em;
  white-space: pre-wrap;
}

/* Raw Data Details */
.raw-data {
  margin-top: 2em;
}

.raw-data__summary {
  cursor: pointer;
  font-size: 1.2em;
  font-weight: bold;
  padding: 0.5em 0;
}

.raw-data__content {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5em;
  margin-top: 1em;
  margin-bottom: 1em;
}

.raw-data__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
}

.raw-data__table thead tr {
  border-bottom: 2px solid #ddd;
}

.raw-data__table tbody tr {
  border-bottom: 1px solid #eee;
}

.raw-data__table th {
  text-align: left;
  padding: 0.5em;
  font-weight: 600;
}

.raw-data__table td {
  padding: 0.5em;
  vertical-align: top;
}

.raw-data__table-property {
  font-family: monospace;
}

.raw-data__table-value {
  word-break: break-word;
}

.raw-data__param {
  font-size: 0.9em;
  margin-bottom: 0.25em;
}

.raw-data__param-key {
  font-weight: 600;
}

/* Book Detail Info */
.book-info {
  margin-bottom: 2em;
}

.book-info__item {
  margin-bottom: 0.5em;
}

/* Book Actions */
.book-actions {
  margin-bottom: 2em;
}

.book-action-button {
  display: inline-block;
  padding: 0.6em 1.2em;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.book-action-button--danger {
  background: var(--color-danger);
  color: white;
}

.book-action-button--danger:hover {
  background: var(--color-danger-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Contact Create Form */
.form-error {
  color: var(--color-danger);
  padding: 0.75em;
  background: #ffe6e6;
  border-radius: 4px;
  margin-bottom: 1.5em;
  border: 1px solid var(--color-danger);
}

.contact-form {
  max-width: 700px;
  display: block;
  margin: 0 auto;
}

.contact-form__section {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.5em;
  margin-bottom: 1.5em;
}

.contact-form__section-title {
  margin-top: 0;
  margin-bottom: 1em;
  font-size: 1.2em;
  color: #2c3e50;
  border-bottom: 2px solid #3498db;
  padding-bottom: 0.5em;
}

.contact-form__field {
  margin-bottom: 1em;
}

.contact-form__label {
  display: block;
  margin-bottom: 0.4em;
  font-weight: 500;
  color: #2c3e50;
}

.contact-form__input,
.contact-form__textarea {
  width: 100%;
  padding: 0.6em;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1em;
  font-family: Arial, sans-serif;
  transition: border-color 0.2s ease;
}

.contact-form__input:focus,
.contact-form__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.contact-form__textarea {
  resize: vertical;
  min-height: 100px;
}

.contact-form__actions {
  display: flex;
  gap: 1em;
  margin-top: 2em;
}

.contact-form__button {
  padding: 0.75em 1.5em;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.contact-form__button--primary {
  background: var(--color-primary);
  color: white;
}

.contact-form__button--primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.contact-form__button--secondary {
  background: var(--color-secondary);
  color: white;
}

.contact-form__button--secondary:hover {
  background: var(--color-secondary-dark);
}

/* Repeating Fields */
.contact-form__repeating-group {
  margin-bottom: 1.5em;
}

.contact-form__repeating-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75em;
}

.contact-form__add-btn {
  padding: 0.5em 1em;
  background: var(--color-success);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.9em;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.contact-form__add-btn:hover {
  background: var(--color-success-dark);
  transform: translateY(-1px);
}

.contact-form__repeating-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75em;
}

.contact-form__repeating-item {
  display: flex;
  gap: 0.5em;
  align-items: flex-start;
  padding: 0.75em;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.contact-form__repeating-item--address {
  flex-direction: column;
  align-items: stretch;
}

.contact-form__repeating-inputs {
  display: flex;
  gap: 0.5em;
  flex: 1;
}

.contact-form__input--repeating {
  flex: 1;
}

.contact-form__select {
  padding: 0.6em;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1em;
  font-family: Arial, sans-serif;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s ease;
  min-width: 120px;
}

.contact-form__select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.contact-form__remove-btn {
  padding: 0.6em 0.75em;
  background: var(--color-danger);
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.85em;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  align-self: flex-start;
}

.contact-form__remove-btn:hover {
  background: var(--color-danger-dark);
}

.contact-form__address-type {
  margin-bottom: 0.75em;
}

.contact-form__address-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75em;
}

.contact-form__repeating-item--address .contact-form__field {
  margin-bottom: 0;
}

/* Delete Confirmation Page */
.delete-warning {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 8px;
  padding: 2em;
  margin-bottom: 2em;
  display: flex;
  gap: 1.5em;
}

.delete-warning__icon {
  font-size: 3em;
  line-height: 1;
}

.delete-warning__content {
  flex: 1;
}

.delete-warning__title {
  margin-top: 0;
  margin-bottom: 0.75em;
  color: #856404;
  font-size: 1.3em;
}

.delete-warning__message {
  margin-bottom: 0.5em;
  color: #856404;
}

.delete-warning__contact-name {
  font-size: 1.2em;
  font-weight: bold;
  color: #2c3e50;
  margin: 1em 0;
  padding: 0.5em;
  background: white;
  border-radius: 4px;
  border-left: 4px solid var(--color-danger);
}

.delete-form {
  max-width: 500px;
}

.delete-form__actions {
  display: flex;
  gap: 1em;
  flex-wrap: wrap;
}

.delete-form__button {
  padding: 0.75em 1.5em;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.delete-form__button--danger {
  background: var(--color-danger);
  color: white;
}

.delete-form__button--danger:hover {
  background: var(--color-danger-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.delete-form__button--secondary {
  background: var(--color-secondary);
  color: white;
}

.delete-form__button--secondary:hover {
  background: var(--color-secondary-dark);
}

/* Action Button (for Create Contact button on book page) */
.action-button {
  display: inline-block;
  padding: 0.75em 1.5em;
  background: var(--color-success);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 1em;
}

.action-button:hover {
  background: var(--color-success-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Address Book Create Form */
.book-form {
  max-width: 600px;
  display: block;
  margin: 0 auto;
}

.book-form__section {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.5em;
  margin-bottom: 1.5em;
}

.book-form__field {
  margin-bottom: 1em;
}

.book-form__label {
  display: block;
  margin-bottom: 0.4em;
  font-weight: 500;
  color: #2c3e50;
}

.book-form__input {
  width: 100%;
  padding: 0.6em;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1em;
  font-family: Arial, sans-serif;
  transition: border-color 0.2s ease;
}

.book-form__input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.book-form__help {
  display: block;
  margin-top: 0.4em;
  color: #666;
  font-size: 0.9em;
}

.book-form__actions {
  display: flex;
  gap: 1em;
  margin-top: 2em;
}

.book-form__button {
  padding: 0.75em 1.5em;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.book-form__button--primary {
  background: var(--color-primary);
  color: white;
}

.book-form__button--primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.book-form__button--secondary {
  background: var(--color-secondary);
  color: white;
}

.book-form__button--secondary:hover {
  background: var(--color-secondary-dark);
}

@media (max-width: 900px) {
  .container {
    box-shadow: none;
    padding-top: 0.5em;
  }

  header {
    padding: 0 1em;
  }

  .header-nav {
    flex-wrap: wrap;
    padding: 0.5em 1em;
  }

  .nav-brand {
    font-size: 1.1em;
  }

  .nav-items {
    flex-wrap: wrap;
  }

  .main-content {
    padding-left: 1em;
    padding-right: 1em;
  }

  footer {
    padding: 1.5em 1em;
  }
}
