/* ============================================================
   DAFTER MAGED — Analyses Page (التحليل الأدبي)
   ============================================================ */

/* ── Analysis Card ── */
.analyses-grid {
  display: flex; flex-direction: column; gap: var(--space-4);
}

.analysis-card {
  background: var(--card-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: all var(--transition-base);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.analysis-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}

/* Book-inspired header */
.analysis-card-header {
  background: linear-gradient(135deg, var(--hdr-from, var(--blue-700)), var(--hdr-to, var(--sky-400)));
  padding: var(--space-4) var(--space-5);
  display: flex; align-items: flex-start; gap: var(--space-4);
  position: relative; overflow: hidden;
}
.analysis-card-header::before {
  content: '';
  position: absolute; top: -30%; left: -10%;
  width: 45%; height: 180%;
  background: rgba(255,255,255,.06); border-radius: 50%;
}
.analysis-book-icon {
  width: 52px; height: 64px;
  background: rgba(255,255,255,.15);
  border-radius: 4px 8px 8px 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: white; position: relative;
  box-shadow: inset -3px 0 0 rgba(0,0,0,.15);
}
.analysis-header-text { position: relative; z-index: 1; }
.analysis-book-title {
  font-size: var(--text-base); font-weight: var(--font-weight-black);
  color: white; line-height: 1.2; margin-bottom: 3px;
}
.analysis-book-author {
  font-size: var(--text-xs); color: rgba(255,255,255,.8);
}
.analysis-header-badge {
  position: absolute; top: var(--space-3); left: var(--space-3);
  background: rgba(255,255,255,.2); backdrop-filter: blur(4px);
  color: white; padding: 2px var(--space-2);
  border-radius: var(--radius-full); font-size: 10px;
  font-weight: var(--font-weight-semi);
}

/* Body */
.analysis-card-body { padding: var(--space-4); }

/* Sections preview */
.analysis-sections-preview {
  display: flex; flex-direction: column; gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.analysis-section-chip {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2); border-radius: var(--radius-md);
  font-size: var(--text-xs);
}
.analysis-section-name {
  font-weight: var(--font-weight-semi); color: var(--color-text);
  min-width: 80px;
}
.analysis-section-preview {
  flex: 1; color: var(--color-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.analysis-section-len {
  color: var(--color-text-subtle); white-space: nowrap;
}

/* Rating stars */
.analysis-rating {
  display: flex; gap: 2px; margin-bottom: var(--space-3);
}
.star-filled { color: #F59E0B; }
.star-empty  { color: var(--color-border); }

/* Footer */
.analysis-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-light);
}
.analysis-meta {
  display: flex; align-items: center; gap: var(--space-3);
  font-size: var(--text-xs); color: var(--color-text-subtle);
}
.analysis-actions { display: flex; gap: var(--space-1); }

/* ── Analysis Editor ── */
.analysis-editor-book-info {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-primary-bg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}
.analysis-editor-book-icon {
  width: 44px; height: 54px;
  background: linear-gradient(135deg, var(--blue-600), var(--sky-400));
  border-radius: 3px 6px 6px 3px;
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
  box-shadow: inset -3px 0 0 rgba(0,0,0,.15);
}

/* Sections editor */
.analysis-sections-editor {
  display: flex; flex-direction: column; gap: var(--space-4);
}
.analysis-section-editor {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.analysis-section-header-edit {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-3);
  border-bottom: 1px solid var(--color-border);
}
.analysis-section-title-label {
  flex: 1; font-size: var(--text-sm);
  font-weight: var(--font-weight-bold); color: var(--color-text);
}
.analysis-section-textarea {
  width: 100%; min-height: 120px; resize: vertical;
  background: none; border: none;
  color: var(--color-text); font-family: var(--font-family);
  font-size: var(--text-sm); line-height: var(--leading-loose);
  padding: var(--space-3) var(--space-4);
}
.analysis-section-textarea::placeholder { color: var(--color-text-subtle); }
.analysis-section-textarea:focus { outline: none; }

/* Rating selector */
.rating-selector {
  display: flex; gap: var(--space-2);
}
.rating-star-btn {
  font-size: 1.4rem; cursor: pointer; border: none;
  background: none; transition: transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  padding: var(--space-1);
}
.rating-star-btn:hover { transform: scale(1.2); }

/* Genre / type selector */
.genre-select { min-width: 140px; }

/* Book picker in modal */
.book-picker {
  display: flex; flex-direction: column; gap: var(--space-2);
  max-height: 200px; overflow-y: auto;
}
.book-picker-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); border-radius: var(--radius-md);
  cursor: pointer; border: 1.5px solid transparent;
  background: var(--color-surface-2);
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.book-picker-item:hover   { border-color: var(--color-primary); background: var(--color-primary-bg); }
.book-picker-item.selected{ border-color: var(--color-primary); background: var(--color-primary-muted); }
.book-picker-cover {
  width: 32px; height: 40px;
  border-radius: 2px 4px 4px 2px;
  background: linear-gradient(135deg, var(--blue-500), var(--sky-400));
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 0.8rem; flex-shrink: 0;
}
.book-picker-info { flex: 1; min-width: 0; }
.book-picker-title  { font-size: var(--text-sm); font-weight: var(--font-weight-semi); color: var(--color-text); }
.book-picker-author { font-size: var(--text-xs); color: var(--color-text-muted); }

/* Color gradients for analysis header */
.grad-0 { --hdr-from:#1D4ED8; --hdr-to:#38BDF8; }
.grad-1 { --hdr-from:#6D28D9; --hdr-to:#A78BFA; }
.grad-2 { --hdr-from:#065F46; --hdr-to:#34D399; }
.grad-3 { --hdr-from:#9A3412; --hdr-to:#FB923C; }
.grad-4 { --hdr-from:#831843; --hdr-to:#F9A8D4; }
.grad-5 { --hdr-from:#1E3A5F; --hdr-to:#7DD3FC; }

/* Empty */
.analyses-empty {
  padding: var(--space-12) var(--space-6);
  display: flex; flex-direction: column;
  align-items: center; gap: var(--space-3); text-align: center;
}

@media (min-width: 768px) {
  .analyses-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) {
  .analyses-grid { grid-template-columns: repeat(3, 1fr); }
}
