/* =====================================================
   YouTube Playlist Manager – Frontend Styles
   ===================================================== */

:root {
  --ytpm-primary:    #ff6900;
  --ytpm-secondary:  #abb8c3;
  --ytpm-dark:       #1a1a2e;
  --ytpm-card-bg:    #ffffff;
  --ytpm-radius:     12px;
  --ytpm-shadow:     0 4px 16px rgba(0, 0, 0, .10);
  --ytpm-shadow-hover: 0 8px 32px rgba(0, 0, 0, .18);
  --ytpm-transition: .25s ease;
}

/* ── Wrap ── */
.ytpm-wrap {
  width: 100%;
  margin: 0 auto;
}

/* ── Grid ── */
.ytpm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* ── Card ── */
.ytpm-card {
  display: flex;
  flex-direction: column;
  background: var(--ytpm-card-bg);
  border-radius: var(--ytpm-radius);
  box-shadow: var(--ytpm-shadow);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition:
    transform var(--ytpm-transition),
    box-shadow var(--ytpm-transition);
}

.ytpm-card:hover,
.ytpm-card:focus-visible {
  transform: translateY(-4px) scale(1.015);
  box-shadow: var(--ytpm-shadow-hover);
  outline: none;
}

/* ── Thumbnail ── */
.ytpm-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.ytpm-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--ytpm-transition);
}

.ytpm-card:hover .ytpm-thumb {
  transform: scale(1.05);
}

.ytpm-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: var(--ytpm-secondary);
}

/* ── Play Button Overlay ── */
.ytpm-play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .30);
  transition: background var(--ytpm-transition);
}

.ytpm-play-btn svg {
  width: 52px;
  height: 52px;
  background: var(--ytpm-primary);
  border-radius: 50%;
  padding: 10px;
  box-shadow: 0 2px 12px rgba(255, 105, 0, .55);
  transition:
    transform var(--ytpm-transition),
    box-shadow var(--ytpm-transition);
}

.ytpm-card:hover .ytpm-play-btn {
  background: rgba(0, 0, 0, .18);
}

.ytpm-card:hover .ytpm-play-btn svg {
  transform: scale(1.12);
  box-shadow: 0 4px 20px rgba(255, 105, 0, .75);
}

/* ── Card Body ── */
.ytpm-card-body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Title ── */
.ytpm-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  color: var(--ytpm-dark);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* ── Description ── */
.ytpm-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #666;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* ── Error / Notice ── */
.ytpm-notice {
  padding: 12px 16px;
  background: #f0f0f0;
  border-left: 4px solid var(--ytpm-secondary);
  border-radius: 4px;
  font-size: 14px;
}

.ytpm-error {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  background: #fff3f3;
  border: 1px solid #f5c6cb;
  border-radius: var(--ytpm-radius);
  font-size: 14px;
  color: #721c24;
}

.ytpm-error-icon {
  font-size: 20px;
  line-height: 1;
}

.ytpm-error p {
  margin: 0;
}

/* ── Skeleton Loader ── */
.ytpm-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.ytpm-skeleton-card {
  border-radius: var(--ytpm-radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--ytpm-shadow);
}

.ytpm-skeleton-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(90deg, #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: ytpm-shimmer 1.4s infinite;
}

.ytpm-skeleton-line {
  margin: 12px 16px 0;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: ytpm-shimmer 1.4s infinite;
}

.ytpm-skeleton-title {
  height: 18px;
  width: 85%;
}

.ytpm-skeleton-desc {
  width: 70%;
}

.ytpm-skeleton-line.short {
  width: 50%;
  margin-bottom: 16px;
}

@keyframes ytpm-shimmer {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .ytpm-grid,
  .ytpm-skeleton-grid {
    grid-template-columns: 1fr;
  }
}
