/*************************************************
 * Theme Grid Layout
 *************************************************/

#themes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;

  max-width: 900px;
  margin: 0 auto;
}

#themes-section {
  display: flex;
  flex-direction: column;
  gap: 28px; /* MUST match #themes-grid gap */
}

.themes-action {
  display: flex;
  justify-content: center;
}

#generate-btn {
  min-width: 180px;
  height: 44px;

  font-size: 15px;
  font-weight: 700;

  border-radius: 10px;
  border: 1px solid #b8bec7;

  background: linear-gradient(
    to bottom,
    #f0f2f4,
    #e3e6ea
  );

  color: #0b2d4f;
  cursor: pointer;

  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.25);
}

#generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

#generate-btn.is-loading {
  pointer-events: none;
  opacity: 0.6;
}

/*************************************************
 * Full-Page Generation Overlay
 *************************************************/

#generation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(3px);
}

#generation-overlay.active {
  display: flex;
}

.generation-spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 48px 64px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.generation-spinner {
  width: 64px;
  height: 64px;
  border: 5px solid rgba(11, 45, 79, 0.15);
  border-top-color: #0b2d4f;
  border-radius: 50%;
  animation: generation-spinner-rotate 0.9s linear infinite;
}

.generation-label {
  font-size: 18px;
  font-weight: 600;
  color: #0b2d4f;
  letter-spacing: 0.5px;
}

@keyframes generation-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}


/*************************************************
 * Locked State (Per-Card Dimming)
 *************************************************/

#themes-grid.is-locked .theme-card {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(20%);
}

/* Excel Actions card should NOT be affected by is-locked on the grid */
#themes-grid.is-locked .excel-actions-card {
  opacity: 1;
  pointer-events: auto;
  filter: none;
}

/* Excel Actions card has its own dimmed state */
#themes-grid .excel-actions-card.is-dimmed {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(30%);
}

/*************************************************
 * Theme Card
 *************************************************/

.theme-card {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;

  display: flex;
  flex-direction: column;

  aspect-ratio: 16 / 9;
  width: 100%;

  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.28);

  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    outline 0.15s ease,
    opacity 0.2s ease;
}

.theme-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.38);
}

/*************************************************
 * Preview Area (Fill More)
 *************************************************/

.theme-preview {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #e5e7eb;
  padding: 4px;
}

.theme-preview img {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center 40%;
}

/*************************************************
 * Footer (Smaller)
 *************************************************/

.theme-footer {
  height: 10%;
  min-height: 40px;

  background: #ffffff;
  border-top: 1px solid #e0e4ea;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 6px 12px;
  box-sizing: border-box;
}

.theme-footer label {
  display: flex;
  align-items: center;
  gap: 8px;

  font-size: 14px;
  font-weight: 600;
  color: #0b2d4f;

  cursor: pointer;
}

/*************************************************
 * Checkbox
 *************************************************/

.theme-footer input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/*************************************************
 * Selected State
 *************************************************/

.theme-card.selected {
  outline: 4px solid rgba(11, 45, 79, 0.65);
  outline-offset: -4px;
}

/*************************************************
 * Inactive Helper Text
 *************************************************/

#themes-grid-overlay {
  margin-top: 36px;

  text-align: center;
  font-weight: 700;
  font-size: 15px;

  color: #ffffff;
}

/*************************************************
 * Excel Actions Card
 *************************************************/

.excel-actions-card {
  cursor: pointer;
}

.excel-actions-card:not(.is-dimmed):hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(30, 115, 60, 0.35);
}

.excel-actions-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, #1e7a3c 0%, #2d9a4e 50%, #3ab564 100%);
  padding: 20px;
}

.excel-actions-icon {
  width: 64px;
  height: 64px;
  color: rgba(255, 255, 255, 0.95);
}

.excel-actions-icon svg {
  width: 100%;
  height: 100%;
}

.excel-actions-title {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.excel-actions-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excel-actions-footer {
  background: #f8faf9;
  border-top: 1px solid #c8e6d0;
}

.excel-actions-label {
  font-size: 13px;
  font-weight: 600;
  color: #1e7a3c;
}

.excel-actions-card.is-dimmed .excel-actions-label {
  color: #888;
}

/*************************************************
 * Excel Actions Modal
 *************************************************/

#excel-actions-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

#excel-actions-modal.hidden {
  display: none;
}

#excel-actions-modal .modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.excel-actions-modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  z-index: 10001;
}

.excel-actions-modal-content .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, #1e7a3c 0%, #2d9a4e 100%);
  border-bottom: none;
}

.excel-actions-modal-content .modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
}

.excel-actions-modal-content .modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.excel-actions-modal-content .modal-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

.excel-actions-modal-content .modal-body {
  padding: 24px;
}

.excel-actions-description {
  margin: 0 0 20px 0;
  font-size: 14px;
  color: #555;
  line-height: 1.5;
}

.excel-actions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.excel-action-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #e0e4ea;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.excel-action-btn:hover {
  border-color: #1e7a3c;
  background: #f8faf9;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(30, 122, 60, 0.15);
}

.excel-action-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  padding: 10px;
  background: linear-gradient(135deg, #1e7a3c 0%, #3ab564 100%);
  border-radius: 10px;
  color: #ffffff;
}

.excel-action-icon svg {
  width: 100%;
  height: 100%;
}

.excel-action-info {
  flex: 1;
  min-width: 0;
}

.excel-action-name {
  font-size: 16px;
  font-weight: 700;
  color: #0b2d4f;
  margin-bottom: 4px;
}

.excel-action-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}
