/* =========================================================
   MY GREY POWER
   MY CONTACTS
   ========================================================= */


/* CONTACTS HERO */

.contacts-hero {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) auto;

  gap: 28px;
  align-items: end;

  margin-bottom: 28px;

  padding: 32px;

  border-radius: var(--radius-lg);

  background:
    linear-gradient(
      135deg,
      #ffffff 0%,
      #eef3f8 100%
    );

  border:
    1px solid var(--border);

  box-shadow: var(--shadow);
}


.contacts-hero h1 {
  margin: 0;

  max-width: 760px;

  font-size:
    clamp(32px, 4vw, 52px);

  line-height: 1.04;

  letter-spacing: -1.5px;

  color: var(--navy-deep);
}


.contacts-hero h1 span {
  color: var(--blue);
}


.contacts-hero p {
  max-width: 720px;

  margin:
    18px 0 0;

  font-size: 16px;
  line-height: 1.65;

  color: var(--muted);
}


.contacts-hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}


/* PRIMARY ACTION */

.contacts-primary-action {
  min-width: 150px;

  padding:
    13px 18px;

  border: 0;
  border-radius: 12px;

  background: var(--navy);
  color: white;

  font-size: 13px;
  font-weight: 800;

  box-shadow:
    0 8px 18px
    rgba(25, 50, 74, 0.12);

  transition:
    transform var(--transition),
    background var(--transition),
    box-shadow var(--transition);
}


.contacts-primary-action:hover {
  transform: translateY(-1px);

  background: var(--blue);

  box-shadow:
    0 12px 24px
    rgba(25, 50, 74, 0.16);
}


/* CONTACTS PANEL */

.contacts-section {
  padding: 26px;

  border-radius: var(--radius-md);

  background: var(--panel);

  border:
    1px solid var(--border);

  box-shadow:
    0 8px 22px
    rgba(25, 50, 74, 0.05);
}


.contacts-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;

  gap: 24px;

  margin-bottom: 22px;
}


.contacts-toolbar h2 {
  margin: 0;

  font-size: 24px;

  color: var(--navy-deep);
}


/* SEARCH */

.contact-search {
  width: min(320px, 100%);

  display: grid;
  gap: 7px;
}


.contact-search span {
  font-size: 10px;
  font-weight: 800;

  text-transform: uppercase;
  letter-spacing: 1.3px;

  color: var(--muted);
}


.contact-search input {
  width: 100%;

  padding:
    11px 13px;

  border:
    1px solid var(--border);

  border-radius: 11px;

  outline: none;

  background: var(--bg);
  color: var(--text);

  transition:
    border var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}


.contact-search input::placeholder {
  color: var(--muted);
}


.contact-search input:focus {
  border-color: var(--blue);

  background: var(--panel);

  box-shadow:
    0 0 0 3px
    rgba(47, 111, 163, 0.1);
}


/* CONTACT LIST */

.contacts-list {
  display: grid;
  gap: 10px;
}


.contact-item {
  display: grid;

  grid-template-columns:
    auto minmax(0, 1fr) auto;

  gap: 15px;
  align-items: center;

  padding:
    15px 16px;

  border-radius: 13px;

  border:
    1px solid var(--border);

  background: var(--panel-soft);

  transition:
    transform var(--transition),
    border var(--transition),
    box-shadow var(--transition);
}


.contact-item:hover {
  transform: translateY(-1px);

  border-color:
    rgba(47, 111, 163, 0.32);

  box-shadow:
    0 8px 18px
    rgba(25, 50, 74, 0.06);
}


.contact-avatar {
  width: 46px;
  height: 46px;

  display: grid;
  place-items: center;

  border-radius: 50%;

  background: #e6edf6;

  color: var(--navy);

  font-size: 14px;
  font-weight: 800;
}


.contact-copy {
  min-width: 0;
}


.contact-name {
  overflow: hidden;

  font-size: 13px;
  font-weight: 800;

  color: var(--navy-deep);

  text-overflow: ellipsis;
  white-space: nowrap;
}


.contact-meta {
  margin-top: 5px;

  font-size: 11px;
  line-height: 1.5;

  color: var(--muted);
}


.contact-actions {
  display: flex;
  align-items: center;

  gap: 7px;
}


/* CONTACT BUTTONS */

.contact-action {
  padding:
    8px 11px;

  border:
    1px solid var(--border);

  border-radius: 9px;

  background: var(--panel);

  color: var(--navy);

  font-size: 11px;
  font-weight: 800;

  transition:
    transform var(--transition),
    background var(--transition),
    border var(--transition);
}


.contact-action:hover {
  transform: translateY(-1px);

  border-color:
    rgba(47, 111, 163, 0.32);

  background: var(--blue-soft);
}


.contact-action.delete {
  color: var(--rose);
}


.contact-action.delete:hover {
  background: var(--rose-soft);

  border-color:
    rgba(155, 116, 116, 0.28);
}


/* EMPTY STATE */

.contacts-empty {
  display: none;

  padding:
    52px 24px;

  text-align: center;

  border:
    1px dashed var(--border);

  border-radius: 14px;

  background:
    linear-gradient(
      135deg,
      var(--panel-soft) 0%,
      var(--panel) 100%
    );
}


.contacts-empty.show {
  display: block;
}


.contacts-empty-icon {
  width: 60px;
  height: 60px;

  display: grid;
  place-items: center;

  margin:
    0 auto 16px;

  border-radius: 50%;

  background: #e6edf6;

  color: var(--navy);

  font-size: 23px;
  font-weight: 800;
}


.contacts-empty h3 {
  margin:
    0 0 8px;

  font-size: 19px;

  color: var(--navy-deep);
}


.contacts-empty p {
  margin:
    0 auto 18px;

  max-width: 420px;

  font-size: 13px;
  line-height: 1.6;

  color: var(--muted);
}


/* SECONDARY ACTION */

.contacts-secondary-action {
  padding:
    10px 14px;

  border:
    1px solid var(--border);

  border-radius: 10px;

  background: var(--panel);

  color: var(--navy);

  font-size: 12px;
  font-weight: 800;

  transition:
    transform var(--transition),
    background var(--transition),
    border var(--transition);
}


.contacts-secondary-action:hover {
  transform: translateY(-1px);

  background: var(--blue-soft);

  border-color:
    rgba(47, 111, 163, 0.28);
}


/* CONTACT EDITOR */

.contact-editor {
  margin-top: 20px;
}


.contact-editor[hidden] {
  display: none;
}


.contact-editor-card {
  padding: 26px;

  border-radius: var(--radius-md);

  background: var(--panel);

  border:
    1px solid var(--border);

  box-shadow:
    0 8px 22px
    rgba(25, 50, 74, 0.05);
}


.contact-editor-heading {
  margin-bottom: 20px;
}


.contact-editor-heading h2 {
  margin: 0;

  font-size: 24px;

  color: var(--navy-deep);
}


/* FORM */

.contact-form {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 18px;
}


.contact-field {
  display: grid;
  gap: 7px;
}


.contact-field-wide {
  grid-column: 1 / -1;
}


.contact-field label {
  font-size: 10px;
  font-weight: 800;

  text-transform: uppercase;
  letter-spacing: 1.2px;

  color: var(--muted);
}


.contact-field input {
  width: 100%;

  min-height: 45px;

  padding:
    11px 13px;

  border:
    1px solid var(--border);

  border-radius: 11px;

  outline: none;

  background: var(--bg);
  color: var(--text);

  transition:
    border var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}


.contact-field input::placeholder {
  color: var(--muted);
}


.contact-field input:focus {
  border-color: var(--blue);

  background: var(--panel);

  box-shadow:
    0 0 0 3px
    rgba(47, 111, 163, 0.1);
}


/* FORM ACTIONS */

.contact-form-actions {
  grid-column: 1 / -1;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  gap: 10px;

  padding-top: 4px;
}


.contacts-save-action {
  min-width: 120px;

  padding:
    11px 15px;

  border: 0;
  border-radius: 10px;

  background: var(--navy);

  color: white;

  font-size: 12px;
  font-weight: 800;

  box-shadow:
    0 8px 18px
    rgba(25, 50, 74, 0.12);

  transition:
    transform var(--transition),
    background var(--transition),
    box-shadow var(--transition);
}


.contacts-save-action:hover {
  transform: translateY(-1px);

  background: var(--blue);

  box-shadow:
    0 12px 24px
    rgba(25, 50, 74, 0.16);
}


/* CONTACTS NOTE */

.contacts-note {
  margin-top: 20px;

  padding:
    16px 19px;

  border-radius: 13px;

  background:
    linear-gradient(
      135deg,
      #e6edf6 0%,
      #edf4ef 100%
    );

  font-size: 13px;
  line-height: 1.55;

  color: var(--muted);
}


.contacts-note strong {
  color: var(--navy);
}


/* DARK MODE */

body.dark-mode .contacts-hero {
  background:
    linear-gradient(
      135deg,
      #18232e 0%,
      #1c2a35 100%
    );
}


body.dark-mode .contacts-section,
body.dark-mode .contact-editor-card {
  background: var(--panel);
}


body.dark-mode .contact-search input,
body.dark-mode .contact-field input {
  background: var(--panel-soft);
}


body.dark-mode .contact-search input:focus,
body.dark-mode .contact-field input:focus {
  background: var(--panel);
}


body.dark-mode .contact-item {
  background: var(--panel-soft);
}


body.dark-mode .contact-avatar,
body.dark-mode .contacts-empty-icon {
  background: #243442;

  color: #c8dceb;
}


body.dark-mode .contact-action,
body.dark-mode .contacts-secondary-action {
  background: #21303c;

  color: #d7e5ef;
}


body.dark-mode .contact-action:hover,
body.dark-mode .contacts-secondary-action:hover {
  background: #293c4b;
}


body.dark-mode .contact-action.delete {
  color: #d7abab;
}


body.dark-mode .contact-action.delete:hover {
  background: #3b2b2e;
}


body.dark-mode .contacts-empty {
  background:
    linear-gradient(
      135deg,
      #1e2b37 0%,
      #18232e 100%
    );
}


body.dark-mode .contacts-note {
  background:
    linear-gradient(
      135deg,
      #1d2c38 0%,
      #1d302c 100%
    );
}


/* RESPONSIVE */

@media (max-width: 850px) {

  .contacts-hero {
    grid-template-columns: 1fr;

    align-items: start;
  }


  .contacts-hero-actions {
    justify-content: flex-start;
  }


  .contacts-toolbar {
    align-items: stretch;
    flex-direction: column;
  }


  .contact-search {
    width: 100%;
  }


  .contact-form {
    grid-template-columns: 1fr;
  }


  .contact-field-wide {
    grid-column: auto;
  }


  .contact-form-actions {
    grid-column: auto;
  }

}


@media (max-width: 620px) {

  .contacts-hero {
    padding: 25px;
  }


  .contacts-hero h1 {
    font-size: 36px;
  }


  .contacts-primary-action {
    width: 100%;
  }


  .contacts-section,
  .contact-editor-card {
    padding: 18px;
  }


  .contact-item {
    grid-template-columns:
      auto minmax(0, 1fr);
  }


  .contact-actions {
    grid-column: 1 / -1;

    width: 100%;
  }


  .contact-action {
    flex: 1;
  }


  .contact-form-actions {
    flex-direction: column-reverse;
  }


  .contacts-secondary-action,
  .contacts-save-action {
    width: 100%;
  }

}