/* Contracts Block - Frontend Styles */

.hostpn-contracts-block {
  margin: 40px 0;
  padding: 30px;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e8e8e8;
}

.hostpn-cb-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #f0f0f0;
  color: #232323;
}

.hostpn-cb-empty {
  color: #888;
  font-style: italic;
  padding: 20px 0;
}

.hostpn-cb-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Card */
.hostpn-cb-card {
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 20px;
  background: #fafafa;
  transition: box-shadow 0.2s ease;
}

.hostpn-cb-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.hostpn-cb-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 16px;
  position: relative;
  padding-right: 36px;
}

.hostpn-cb-card-header.hostpn-toggle {
  cursor: pointer;
  margin-bottom: 0;
  user-select: none;
}

.hostpn-cb-card-body {
  margin-top: 16px;
}

.hostpn-cb-collapse-icon {
  font-size: 22px;
  color: #94a3b8;
  transition: color 0.15s ease;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.hostpn-cb-card-header.hostpn-toggle:hover .hostpn-cb-collapse-icon {
  color: #333;
}

.hostpn-cb-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hostpn-cb-card-type {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: #333;
}

.hostpn-cb-card-version {
  font-size: 12px;
  color: #888;
  font-weight: 400;
}

/* Status badges */
.hostpn-cb-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hostpn-cb-status-draft {
  background: #e0e0e0;
  color: #555;
}

.hostpn-cb-status-sent {
  background: #e3f2fd;
  color: #1565c0;
}

.hostpn-cb-status-signed {
  background: #e8f5e9;
  color: #2e7d32;
}

.hostpn-cb-status-expired {
  background: #fff3e0;
  color: #e65100;
}

.hostpn-cb-status-cancelled {
  background: #ffebee;
  color: #c62828;
}

/* Dates */
.hostpn-cb-card-dates {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #666;
  font-size: 14px;
  flex-basis: 100%;
}

.hostpn-cb-date {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hostpn-cb-date-separator {
  color: #ccc;
}

/* Actions */
.hostpn-cb-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hostpn-cb-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #555;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.hostpn-cb-btn:hover {
  background: #f5f5f5;
  border-color: #bbb;
  color: #333;
}

.hostpn-cb-btn i {
  font-size: 18px;
}

.hostpn-contracts-block br {
  display: none;
}

.hostpn-contracts-block p {
  margin: 0;
  padding: 0;
  display: contents;
}

.hostpn-cb-preview-content br {
  display: initial;
}

.hostpn-cb-preview-content p {
  display: block;
  margin: 0 0 1em;
  padding: 0;
}

/* Override theme link colors for all elements in contracts block */
.hostpn-contracts-block a,
.hostpn-contracts-block a:visited {
  color: inherit;
  text-decoration: none;
}

.hostpn-cb-meta-item,
.hostpn-cb-meta-item a,
.hostpn-cb-meta-item a:visited,
.hostpn-cb-meta-item a:hover {
  color: #94a3b8;
}

.hostpn-cb-meta-item .hostpn-icon-small,
.hostpn-cb-meta-item a .hostpn-icon-small {
  color: #64748b;
}

.hostpn-cb-btn-preview {
  padding: 4px 10px;
  font-size: 12px;
}

.hostpn-cb-btn-preview i {
  font-size: 16px;
}

.hostpn-cb-btn-preview.active {
  background: #e3f2fd;
  border-color: #90caf9;
  color: #1565c0;
}

a.hostpn-cb-btn-download,
a.hostpn-cb-btn-download:visited {
  border-color: #a5d6a7;
  color: #2e7d32;
}

a.hostpn-cb-btn-download:hover {
  background: #e8f5e9;
  color: #2e7d32;
}

.hostpn-cb-btn-gen-pdf {
  padding: 4px 10px;
  font-size: 12px;
}

.hostpn-cb-btn-gen-pdf i {
  font-size: 16px;
}

.hostpn-cb-btn-gen-pdf:disabled {
  opacity: 0.6;
  pointer-events: none;
}

a.hostpn-cb-btn-signed,
a.hostpn-cb-btn-signed:visited {
  border-color: #90caf9;
  color: #1565c0;
}

a.hostpn-cb-btn-signed:hover {
  background: #e3f2fd;
  color: #1565c0;
}

.hostpn-cb-btn-upload {
  border-color: #ffcc80;
  color: #e65100;
}

.hostpn-cb-btn-upload:hover {
  background: #fff3e0;
}

.hostpn-cb-btn-upload.uploading {
  opacity: 0.6;
  pointer-events: none;
}

/* Preview area */
.hostpn-cb-card-preview {
  margin-top: 16px;
  padding: 20px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  max-height: 500px;
  overflow-y: auto;
}

.hostpn-cb-preview-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #888;
  padding: 20px;
  justify-content: center;
}

.hostpn-cb-preview-content {
  font-size: 14px;
  line-height: 1.7;
}

.hostpn-cb-preview-content h1 {
  font-size: 20px;
  text-align: center;
}

.hostpn-cb-preview-content h2 {
  font-size: 17px;
}

.hostpn-cb-preview-content h3 {
  font-size: 15px;
}

/* Spin animation */
@keyframes hostpn-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.hostpn-spin {
  animation: hostpn-spin 1s linear infinite;
}

/* Upload success message */
.hostpn-cb-upload-success {
  margin-top: 8px;
  padding: 8px 12px;
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 4px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Print */
@media print {
  .no-print {
    display: none !important;
  }
}

/* Responsive */
@media (max-width: 600px) {
  .hostpn-contracts-block {
    padding: 16px;
    margin: 20px 0;
  }

  .hostpn-cb-card-header {
    flex-direction: column;
  }

  .hostpn-cb-card-actions {
    flex-direction: column;
  }

  .hostpn-cb-btn {
    width: 100%;
    justify-content: center;
  }

  .hostpn-cb-card-preview {
    max-height: 300px;
  }

  .hostpn-cb-create-row {
    flex-direction: column;
  }

  .hostpn-cb-create-select {
    min-width: 100%;
  }
}

/* ─── Create contract section ─── */
.hostpn-cb-create-section {
  background: #f5f7fa;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.hostpn-cb-create-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hostpn-cb-create-title .hostpn-icon-small {
  font-size: 18px;
  color: #1565c0;
}

.hostpn-cb-create-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hostpn-cb-create-select {
  flex: 1;
  min-width: 250px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 14px;
}

.hostpn-cb-btn-create {
  white-space: nowrap;
}

.hostpn-cb-create-attach-row {
  margin-top: 12px;
}

.hostpn-cb-create-attach-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.hostpn-cb-create-attach-label .hostpn-icon-small {
  font-size: 18px;
}

#hostpn-cb-create-pdf {
  display: block;
  font-size: 13px;
  color: #555;
}

.hostpn-cb-create-msg,
.hostpn-cb-sign-msg,
.hostpn-cb-notify-msg {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
}

.hostpn-cb-msg-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.hostpn-cb-msg-error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.hostpn-cb-error-text {
  color: #c62828;
}

/* ─── Contract card meta (room, guest) ─── */
.hostpn-cb-card-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 0;
}

.hostpn-cb-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #94a3b8;
}

.hostpn-cb-meta-item .hostpn-icon-small {
  font-size: 16px;
  color: #64748b;
}

/* ─── Signing section ─── */
.hostpn-cb-sign-section {
  border-top: 1px solid #e0e0e0;
  padding: 16px 20px;
  margin-top: 0;
}

.hostpn-cb-sign-checkbox-row {
  margin-bottom: 12px;
}

.hostpn-cb-sign-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}

.hostpn-cb-sign-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #1a73e8;
  cursor: pointer;
}

.hostpn-cb-sign-upload-row {
  margin-bottom: 14px;
}

.hostpn-cb-sign-upload-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
}

.hostpn-cb-sign-file {
  display: block;
  font-size: 13px;
  color: #666;
}

.hostpn-cb-btn-sign {
  background: #2e7d32 !important;
  color: #fff !important;
  border-color: #2e7d32 !important;
}

.hostpn-cb-btn-sign:hover:not(:disabled) {
  background: #388e3c !important;
}

.hostpn-cb-btn-sign:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Notify changes section ─── */
.hostpn-cb-notify-section {
  border-top: 1px solid #e0e0e0;
  padding: 16px 20px;
  margin-top: 0;
}

.hostpn-cb-notify-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 0 0 10px;
}

.hostpn-cb-notify-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  box-sizing: border-box;
}

.hostpn-cb-notify-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.hostpn-cb-btn-send-notify {
  background: #e65100 !important;
  color: #fff !important;
  border-color: #e65100 !important;
}

.hostpn-cb-btn-send-notify:hover:not(:disabled) {
  background: #ef6c00 !important;
}

.hostpn-cb-btn-cancel-notify {
  background: #f5f5f5 !important;
  color: #555 !important;
  border-color: #ccc !important;
}

.hostpn-cb-btn-cancel-notify:hover {
  background: #e0e0e0 !important;
}

.hostpn-cb-btn-notify .material-icons-outlined {
  color: #ff9800;
}

/* ─── Attachment count badge in header ─── */
.hostpn-cb-att-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: #888;
  font-weight: 500;
}

.hostpn-cb-att-count .hostpn-icon-small {
  font-size: 15px;
  color: #999;
}

/* ─── Upload contract PDF section ─── */
.hostpn-cb-upload-pdf-section {
  margin-top: 12px;
}

.hostpn-cb-btn-upload-pdf {
  border-color: #90caf9;
  color: #1565c0;
}

.hostpn-cb-btn-upload-pdf:hover {
  background: #e3f2fd;
}

.hostpn-cb-btn-upload-pdf.uploading {
  opacity: 0.6;
  pointer-events: none;
}

.hostpn-cb-upload-pdf-msg {
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
}

/* ─── Attachments section ─── */
.hostpn-cb-attachments-section {
  border-top: 1px solid #e0e0e0;
  margin-top: 16px;
  padding-top: 12px;
}

.hostpn-cb-attachments-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hostpn-cb-attachments-toggle:hover {
  color: #333;
}

.hostpn-cb-att-chevron {
  transition: transform 0.2s ease;
}

.hostpn-cb-att-chevron-open {
  transform: rotate(180deg);
}

.hostpn-cb-attachments-body {
  padding-top: 10px;
}

.hostpn-cb-attachments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hostpn-cb-attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f5f7fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
  transition: opacity 0.2s ease;
}

.hostpn-cb-attachment-item > .hostpn-icon-small {
  color: #999;
  font-size: 18px;
}

.hostpn-cb-att-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hostpn-cb-att-date {
  color: #999;
  font-size: 12px;
  flex-shrink: 0;
}

.hostpn-cb-att-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  border-radius: 4px;
  cursor: pointer;
  color: #888;
  text-decoration: none;
  flex-shrink: 0;
}

.hostpn-cb-att-action:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #333;
}

.hostpn-cb-att-download:hover {
  color: #1565c0;
}

.hostpn-cb-att-delete:hover {
  color: #c62828;
}

.hostpn-cb-att-add-row {
  margin-top: 10px;
}

.hostpn-cb-btn-add-att {
  font-size: 13px;
}

.hostpn-cb-att-msg {
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
}
