/* File: calls.css */

/* --- Call Log Section Layout --- */
#call-log-section.panel--bottom {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  margin-top: 0;
  padding-inline: 20px;
  padding-top: 0;
  width: 100%;
}

/* Header Layout */
.call-log-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 var(--space-2) 0;
  position: relative;
}

#call-log-header {
  display: grid;
  grid-template-columns: 15% 20% 10% 1fr;
  gap: 6px;
  padding: 6px 0;
  font-weight: bold;
  border-bottom: 1px solid #ccc;
  align-items: center;
  margin: 0;
}

#call-log-title {
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 30%;
  margin: 0;
  padding: 0;
}

.call-log-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding-right: 15px;
}

#show-call-stats-button,
#add-call-button {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

#show-call-stats-button .plus,
#add-call-button .plus {
  height: 20px;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  line-height: 20px;
}

#show-call-stats-button .label,
#add-call-button .label {
  font-size: 12px;
  line-height: 14px;
  white-space: nowrap;
}

.call-log-column,
.call-log-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 3px;
  font-size: 14px;
}

.call-log-row {
  display: grid;
  grid-template-columns: 15% 20% 10% 1fr;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid #eee;
  align-items: center;
}

/* --- Fixed notes cell --- */
.call-log-notes-cell {
  display: flex;
  align-items: center;
  min-width: 0;
  position: relative;
  padding-right: 2rem;
}

.notes-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  margin-right: 0.75em;
}

.more-notes-btn {
  flex: 0 0 auto;
  margin-left: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  color: #007bff;
  z-index: 1;
}

#call-log-body .call-log-row .call-log-cell:nth-child(4) button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

/* --- Call Log Body --- */
#call-log-body {
  flex: 1 1 0%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 0.5rem;
  min-height: 0;
}

/* === Add Call Modal Overlay === */
#call-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.42);
  z-index: 2000;
}

#call-modal.hidden {
  display: none !important;
}

/* === Modal Content Box === */
#call-modal .modal-content {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  padding: 1.2rem 2rem 2rem 2rem;
  width: 100%;
  max-width: 430px;
  min-width: 320px;
  position: relative;
  text-align: left;
  animation: modal-pop-in 0.2s cubic-bezier(.4,2,.6,1) backwards;
}

@keyframes modal-pop-in {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* === Modal Heading === */
#call-modal .call-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.2rem 0;
}

#call-modal .modal-content h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  text-align: center;
  color: #22294f;
  flex: 1 1 auto;
}

#toggle-call-popout {
  width: 34px;
  height: 34px;
  border: 1px solid #d4dbe8;
  border-radius: 9px;
  background: #fff;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

#toggle-call-popout:hover,
#toggle-call-popout:focus {
  background: #f8fafc;
  border-color: #b8c4d8;
  transform: translateY(-1px);
}

/* === Inputs and Labels === */
#call-modal label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #223;
}

#call-modal input[type="text"],
#call-modal textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #ccd6e6;
  border-radius: 6px;
  font-size: 1rem;
  background: #f7fafd;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

#call-modal input[type="text"]:focus,
#call-modal textarea:focus {
  outline: none;
  border-color: #4b6cb7;
  background: #fff;
}

#call-modal .radio-group {
  display: flex;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
  padding-left: 0.3rem;
}

#call-modal .radio-group label {
  font-weight: 500;
  color: #333;
  margin-bottom: 0;
}

#call-modal .button-group {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

#call-modal .button-group button {
  padding: 0.45rem 1.15rem;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.17s, transform 0.13s;
}

#call-modal .button-group button:hover,
#call-modal .button-group button:focus {
  background: linear-gradient(90deg, #5661f6 0%, #283e51 100%);
  transform: translateY(-2px) scale(1.04);
}

#call-modal .button-group #cancel-call {
  background: #ddd;
  color: #333;
  font-weight: 500;
}

#call-modal .button-group #cancel-call:hover,
#call-modal .button-group #cancel-call:focus {
  background: #bbb;
  color: #222;
}

/* === Global footer composer === */
#call-footer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.16);
  z-index: 12990;
  pointer-events: none;
}

#call-footer-backdrop.hidden {
  display: none !important;
}

#call-footer-composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 13000;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.98);
  border-top: 1px solid #d7dfeb;
  box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.10);
}

#call-footer-composer.hidden {
  display: none !important;
}

#call-footer-caller {
  width: 220px;
  min-width: 220px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #ccd6e6;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #f8fafc;
  box-sizing: border-box;
}

#call-footer-notes {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #ccd6e6;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #f8fafc;
  box-sizing: border-box;
}

#call-footer-caller:focus,
#call-footer-notes:focus {
  outline: none;
  border-color: #4b6cb7;
  background: #fff;
}

#call-footer-popin {
  height: 38px;
  padding: 0 14px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

#call-footer-popin:hover,
#call-footer-popin:focus {
  background: linear-gradient(90deg, #5661f6 0%, #283e51 100%);
}

/* Call Details */
.call-details-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-details-content {
  background-color: white;
  padding: 30px;
  border-radius: 12px;
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.call-details-content h2 { margin-top: 0; font-size: 22px; }
.call-details-content p { margin-bottom: 10px; line-height: 1.4; }

.close-call-details {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
}

/* Search bar */
#search-call-input {
  margin: 0 0.5rem;
  padding: 4px 8px;
  font-size: 14px;
  width: 150px;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-left: -1px;
}

#search-call-icon {
  font-size: 20px;
  cursor: pointer;
  margin-right: auto;
}

/* Manual Link Modal */
#manual-link-modal.modal,
#manual-link-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
}

#manual-link-modal.hidden {
  display: none !important;
}

#manual-link-modal .modal-content,
#manual-link-modal .manual-link-modal-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  padding: 2rem 2rem 3.5rem 2rem;
  width: 100%;
  max-width: 420px;
  min-width: 270px;
  position: relative;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  animation: modal-pop-in 0.2s cubic-bezier(.4,2,.6,1) backwards;
  min-height: 340px;
  justify-content: flex-start;
  overflow: visible;
}

#manual-link-modal .close-button {
  position: absolute;
  top: 14px;
  right: 20px;
  font-size: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: #8866aa;
  z-index: 2;
  padding: 0 5px;
  line-height: 1;
}

#manual-link-modal .close-button:hover,
#manual-link-modal .close-button:focus {
  color: #4b6cb7;
}

#manual-link-modal .manual-link-title {
  margin: 0 0 1.2rem 0;
  font-size: 1.45rem;
  font-weight: 700;
  text-align: center;
  color: #22294f;
  letter-spacing: 0.01em;
  padding-top: 6px;
}

#manual-link-modal input[type="search"] {
  width: 100%;
  padding: 0.65rem 1rem;
  margin-bottom: 1.2rem;
  border: 1px solid #ccd6e6;
  border-radius: 7px;
  font-size: 1.08rem;
  background: #f7fafd;
  box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s;
}

#manual-link-modal input[type="search"]:focus {
  outline: none;
  border-color: #4b6cb7;
  background: #fff;
}

#manual-link-modal .manual-link-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.1rem 0;
  flex: 1 1 auto;
  width: 100%;
  min-height: 90px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
  overflow-x: hidden;
}

#manual-link-modal .profile-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f7fafd;
  border: 1.5px solid #e0e4ef;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  box-shadow: 0 1px 5px rgba(76,108,183,0.04);
  gap: 1.3rem;
}

#manual-link-modal .profile-list-item strong {
  font-size: 1.07em;
  font-weight: 600;
  color: #223;
  margin-bottom: 0.15em;
}

#manual-link-modal .profile-link-btn {
  padding: 0.33em 1.22em;
  font-size: 1em;
  border-radius: 7px;
  background: linear-gradient(90deg, #4b6cb7 0%, #182848 100%);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s, transform 0.14s;
  box-shadow: 0 1px 1.5px #4b6cb71a;
}

#manual-link-modal .profile-link-btn:hover,
#manual-link-modal .profile-link-btn:focus {
  background: linear-gradient(90deg, #5661f6 0%, #283e51 100%);
  transform: translateY(-1px) scale(1.04);
}

#manual-link-modal .manual-link-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85em;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding-bottom: 1.1em;
  background: transparent;
  margin: 0;
  z-index: 1;
}

#manual-link-modal .manual-link-pagination button {
  padding: 0.37em 1.18em;
  font-size: 1.07em;
  border-radius: 7px;
  background: #eee;
  border: none;
  color: #444;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.13s;
}

#manual-link-modal .manual-link-pagination button:disabled {
  background: #ddd;
  color: #aaa;
  cursor: default;
}

#manual-link-modal .manual-link-pagination button:not(:disabled):hover {
  background: #d2dbf3;
  color: #222;
}

#manual-link-modal .manual-link-pagination span {
  min-width: 2em;
  text-align: center;
  font-weight: 600;
  font-size: 1.08em;
}

/* Call Stats page */
#call-stats-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #fff;
  z-index: 10000;
  display: flex;
  flex-direction: column;
}

#call-stats-page.hidden {
  display: none !important;
}

.call-stats-body {
  padding: 18px 18px 28px;
  overflow-y: auto;
}

#call-stats-page .call-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  max-width: 900px;
}

#call-stats-page .call-stat-card {
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
}

#call-stats-page .call-stat-card-wide {
  grid-column: 1 / -1;
}

#call-stats-page .call-stat-label {
  font-size: 13px;
  line-height: 16px;
  opacity: 0.75;
  margin-bottom: 8px;
}

#call-stats-page .call-stat-value {
  font-size: 34px;
  line-height: 38px;
  font-weight: 700;
}

#call-stats-page .call-stat-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

#call-stats-page .call-stat-split-title {
  font-size: 12px;
  line-height: 14px;
  opacity: 0.7;
  margin-bottom: 4px;
}

#call-stats-page .call-stat-split-value {
  font-size: 20px;
  line-height: 26px;
  font-weight: 700;
}

#call-stats-page .call-stat-muted {
  font-weight: 500;
  opacity: 0.75;
}

#call-stats-page .call-stat-footnote {
  margin-top: 10px;
  font-size: 12px;
  line-height: 14px;
  opacity: 0.65;
}

#call-stats-page .call-stats-section {
  margin-top: 18px;
  padding: 0 6px;
}

#call-stats-page .call-stats-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

#call-stats-page .call-stats-section-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

#call-stats-page .call-stats-toggle {
  display: flex;
  gap: 8px;
}

#call-stats-page .call-stats-toggle-btn {
  border: 1px solid #cfcfcf;
  background: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 14px;
}

#call-stats-page .call-stats-toggle-btn.active {
  border-color: #111;
  font-weight: 700;
}

#call-stats-page .call-stats-list {
  border: 1px solid #e2e2e2;
  border-radius: 12px;
  padding: 10px 12px;
}

#call-stats-page .call-stats-row {
  display: grid;
  grid-template-columns: 34px 1fr 42px;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

#call-stats-page .call-stats-row:last-child {
  border-bottom: none;
}

#call-stats-page .call-stats-rank {
  font-size: 12px;
  opacity: 0.7;
  text-align: right;
}

#call-stats-page .call-stats-name {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#call-stats-page .call-stats-count {
  font-size: 13px;
  text-align: right;
  font-weight: 600;
}

#call-stats-page .call-stats-empty {
  padding: 10px 2px;
  font-size: 13px;
  opacity: 0.7;
}

#call-stats-page .call-stats-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}

#call-stats-page .call-stat-card.call-stat-card-list {
  padding: 14px 14px 10px 14px;
}

#call-stats-page .call-stats-ranked-list {
  margin-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

@media (max-width: 720px) {
  #call-stats-page .call-stats-trend-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  #call-stats-page .call-stats-top-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #call-stats-page .call-stats-grid {
    grid-template-columns: 1fr;
  }

  #call-stats-page .call-stat-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  #manual-link-modal .modal-content,
  #manual-link-modal .manual-link-modal-content {
    max-width: 96vw;
    min-width: 0;
    padding: 1.1rem 0.5rem 3rem 0.5rem;
  }

  #manual-link-modal .manual-link-title {
    font-size: 1.08rem;
  }

  #manual-link-modal input[type="search"] {
    font-size: 0.98rem;
    padding: 0.44rem 0.68rem;
  }
}

@media (max-width: 500px) {
  #call-modal .modal-content {
    max-width: 96vw;
    min-width: 0;
    padding: 1rem 0.7rem 1.2rem 0.7rem;
  }

  #call-modal .modal-content h2 {
    font-size: 1.15rem;
  }

  #toggle-call-popout {
    width: 30px;
    height: 30px;
  }

  #call-modal .button-group button {
    font-size: 0.95rem;
    padding: 0.39rem 0.7rem;
  }

  #call-footer-composer {
    flex-wrap: wrap;
    gap: 8px;
  }

  #call-footer-caller {
    width: 100%;
    min-width: 0;
  }

  #call-footer-notes {
    width: 100%;
    flex: 1 1 100%;
  }

  #call-footer-popin {
    width: 100%;
  }
}
