/**
 * Vareon Calculator Suite Pro - Editor Modal Styles
 *
 * Styles for the "Choose Calculator" modal in Gutenberg.
 *
 * @package Vareon_Calculator_Suite_Pro
 */

.components-modal__frame.vcm-modal {
  width: min(85vw, 1000px);
  max-width: 1000px;
  max-height: min(90vh, 860px);
  border-radius: 12px;
}

.components-modal__frame.vcm-modal .components-modal__content,
.components-modal__content.vcm-modal {
  padding: 0;
  margin-top: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.components-modal__frame.vcm-modal .components-modal__header,
.components-modal__header.vcm-modal {
  display: none;
}

.vcm-body {
  display: flex;
  flex-direction: column;
  height: min(78vh, 720px);
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.vcm-header {
  flex-shrink: 0;
  padding: 24px 28px 0;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.vcm-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.vcm-header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.vcm-header__title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.vcm-header__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.vcm-header__title-icon {
  flex-shrink: 0;
}

img.vcm-header__title-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

span.vcm-header__title-icon {
  font-size: 26px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vcm-header__subtitle {
  margin: 0;
  font-size: 13px;
  color: #94a3b8;
}

.vcm-close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  color: #64748b;
  box-shadow: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.vcm-close:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #334155;
}

.vcm-grid-area {
  flex-grow: 1;
  overflow-y: auto;
  background: #f8fafc;
  min-height: 300px;
}

.vcm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  padding: 20px 24px;
  align-content: start;
}

.vcm-grid-area--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.vcm-grid--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: clamp(240px, 46vh, 430px);
  padding: 28px 24px;
}

.vcm-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 14px 18px;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.vcm-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  background: #fafbff;
}

.vcm-card.is-selected {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.04);
}

.vcm-card__check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.vcm-card__icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: 10px;
}

.vcm-card__title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
  margin-bottom: 4px;
}

.vcm-card__desc {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 170px;
}

.vcm-empty {
  grid-column: 1 / -1;
  width: min(520px, 100%);
  margin: 0 auto;
  text-align: center;
  padding: 56px 36px;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.vcm-empty__icon {
  display: block;
  font-size: 56px;
  margin-bottom: 18px;
  opacity: 0.55;
}

.vcm-empty__title {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 10px;
}

.vcm-empty__hint {
  font-size: 15px;
  line-height: 1.45;
  color: #64748b;
}

.vcm-footer {
  flex-shrink: 0;
  border-top: 1px solid #e2e8f0;
  padding: 16px 28px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.vcm-footer__selection {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.vcm-footer__sel-icon {
  font-size: 22px;
  line-height: 1;
}

.vcm-footer__sel-info {
  min-width: 0;
}

.vcm-footer__sel-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vcm-footer__sel-hint {
  font-size: 12px;
  color: #94a3b8;
}

.vcm-footer__theme {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.vcm-footer__theme-label {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

.vcm-theme-btn {
  min-width: 220px;
  padding: 9px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  color: #0f172a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  gap: 8px;
}

.vcm-theme-btn__label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vcm-theme-btn__arrow {
  font-size: 10px;
  color: #64748b;
}

.vcm-theme-list {
  width: 240px;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.vcm-theme-option {
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vcm-theme-option:hover {
  background: #f1f5f9;
}

.vcm-theme-option.is-selected {
  background: rgba(37, 99, 235, 0.06);
  color: #2563eb;
  font-weight: 600;
}

.vcm-theme-option__check {
  color: #3b82f6;
  font-size: 13px;
}

.vcm-footer__actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.vcm-btn-cancel {
  padding: 9px 18px;
  background: transparent;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
}

.vcm-btn-cancel:hover {
  background: #f1f5f9;
  color: #334155;
}

.vcm-btn-insert {
  padding: 10px 28px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.vcm-btn-insert:disabled {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
}

.vcm-btn-insert__arrow {
  font-size: 16px;
  line-height: 1;
}

@media (max-width: 860px) {
  .vcm-header__top {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .vcm-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .vcm-footer__theme {
    width: 100%;
  }

  .vcm-theme-btn {
    width: 100%;
  }

  .vcm-footer__actions {
    justify-content: flex-end;
  }

  .vcm-grid--empty {
    min-height: 260px;
    padding: 20px 16px;
  }

  .vcm-empty {
    padding: 42px 20px;
  }

  .vcm-empty__icon {
    font-size: 48px;
  }

  .vcm-empty__title {
    font-size: 18px;
  }

  .vcm-empty__hint {
    font-size: 14px;
  }
}

@media (max-width: 640px) {
  .vcm-header__top {
    flex-direction: column;
  }

  .vcm-close {
    width: 40px;
    height: 40px;
  }
}
