/* 
 * Joyful Hints Page Specific Styles 
 * Path: css/pages/joyful_hints.css
 * Follows the New HUB Design System (based on genki_methods.html)
 */

/* =========================================
   Hero Section & Video Theater
   ========================================= */
.chapter-hero {
  background: linear-gradient(
    135deg,
    rgba(254, 243, 199, 0.8) 0%,
    rgba(251, 191, 36, 0.8) 100%
  );
  padding: 3.5rem 2rem 3rem;
  border-radius: 40px;
  text-align: center;
  margin-bottom: 3.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(251, 191, 36, 0.2);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition:
    transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    box-shadow 0.4s ease;
}

/* Video Theater Adaptation */
.video-theater-container.hero-video-mode {
  width: 320px;
  max-width: 90%;
  aspect-ratio: 16 / 9;
  height: auto;
  margin: 0 auto 2rem;
  padding: 0;
  border-radius: 20px;
  background: #000;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  border: 5px solid #fff;
  cursor: pointer;
  transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.video-theater-container.hero-video-mode.is-playing {
  width: 100%;
  max-width: 900px;
}

.video-frame {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
}

.video-frame video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.video-overlay,
.video-replay-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: all 0.4s ease;
  background: rgba(0, 0, 0, 0.05); /* Very subtle dim for contrast */
}

.play-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateY(20px); /* Counter-balance the text below to keep the circle centered */
}

.play-circle {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 15px 35px rgba(255, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.play-circle i { color: white; font-size: 2rem; transform: translateX(4px); }
.play-text {
    color: #cc0000; margin-top: 1.2rem; font-weight: 800; font-size: 0.85rem;
    letter-spacing: 0.2em; text-transform: uppercase;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.video-theater-container.is-playing .video-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.video-theater-container.is-finished .video-replay-overlay {
    opacity: 1;
    visibility: visible;
}

.video-replay-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 25; transition: all 0.4s ease;
    opacity: 0; visibility: hidden;
    backdrop-filter: blur(8px);
    color: #fff;
}

.replay-trigger { display: flex; flex-direction: column; align-items: center; gap: 1rem; cursor: pointer; }
.replay-trigger i { font-size: 2.5rem; color: #fff; }

/* Video Seeker Styling */
.video-controls-ui {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
  padding: 2.5rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 30;
  pointer-events: none;
}

.video-theater-container.is-playing .video-controls-ui {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.progress-bar-container {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}

.progress-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #fbbf24;
  border-radius: 3px;
  width: 0%;
}

.time-display {
  color: #fff;
  font-size: 0.75rem;
  font-family: "Outfit", sans-serif;
}

/* Decorative Icons with Parallax */
.hero-deco-1 {
  position: absolute;
  top: 15%;
  left: 8%;
  font-size: 7rem;
  color: rgba(255, 255, 255, 0.2);
  transform: rotate(-20deg);
  pointer-events: none;
}

.hero-deco-2 {
  position: absolute;
  bottom: 8%;
  right: 8%;
  font-size: 8rem;
  color: rgba(255, 255, 255, 0.2);
  transform: rotate(15deg);
  pointer-events: none;
}

/* Typography */
.chapter-hero h1 {
  margin: 0 auto;
  line-height: 1.4;
  color: #1e293b;
}

.hero-top-text {
  font-family: "Outfit", sans-serif;
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: #451a03;
  display: inline-block;
  margin-bottom: 0.8rem;
  opacity: 0.8;
}

.hero-main-title {
  font-family: "Zen Maru Gothic", sans-serif;
  font-size: 3.8rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #1e293b 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  filter: drop-shadow(0 4px 10px rgba(255, 255, 255, 0.3));
}

.chapter-hero .line {
  margin: 1.5rem auto 0;
  width: 60px;
  background: #f59e0b;
  height: 4px;
  border-radius: 2px;
  opacity: 0.6;
}

/* =========================================
   HUB Dashboard (Intro & Quick Action)
   ========================================= */
.hub-dashboard {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 3.5rem;
}

.intro-text {
  text-align: left;
  margin: 0;
  color: #64748b;
  line-height: 1.7;
  font-size: 0.95rem;
  font-weight: 500;
  border-left: 3px solid #fde68a;
  padding-left: 1.5rem;
}

.recommend-card.compact {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.5);
  position: relative;
  overflow: hidden;
}

.recommend-content {
  flex: 1;
}

.recommend-content h3 {
  font-size: 1.05rem;
  color: #1e293b;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
}

.recommend-content p {
  color: #94a3b8;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
}

/* Premium Pill Button from Screenshot */
.btn-premium.mini {
  padding: 0.7rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #6ee7b7 0%, #3b82f6 100%);
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.2);
  white-space: nowrap;
}

.btn-premium.mini:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 15px 30px rgba(59, 130, 246, 0.3);
  filter: brightness(1.1);
}

.btn-premium.mini:active {
  transform: translateY(-1px) scale(0.98);
}

.btn-premium.mini:disabled {
  background: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
}

@media (max-width: 991px) {
  .hub-dashboard {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   Method Groups & Tiles
   ========================================= */
.method-group {
  margin-bottom: 3.5rem;
}

.group-title {
  font-size: 1.3rem;
  color: #334155;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.group-title i {
  background: #fffbeb;
  padding: 0.5rem;
  border-radius: 12px;
  font-size: 1.2rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .category-grid {
    grid-template-columns: 1fr;
  }
}

.category-tile {
  background: #fff;
  border-radius: 20px;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 2px 4px -1px rgba(0, 0, 0, 0.01);
  border: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.category-tile:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.12);
  border-color: var(--aura-color, #fde68a);
}

/* Auras per group */
.method-group.group-action {
  --aura-color: #fbbf24;
} /* Amber */
.method-group.group-mindset {
  --aura-color: #f472b6;
} /* Pink */
.method-group.group-luck {
  --aura-color: #34d399;
} /* Emerald */

.category-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    circle at center,
    var(--aura-color),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
  filter: blur(25px);
}

.category-tile:hover::before {
  opacity: 0.15;
}

.category-tile > i {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: #94a3b8;
  transition: all 0.3s ease;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 50%;
}

.category-tile:hover > i {
  transform: scale(1.1);
  color: #f59e0b;
}

/* Specific Hub Icon Colors */
.method-group.group-action .category-tile > i {
  color: #f59e0b;
  background: #fffbeb;
}
.method-group.group-mindset .category-tile > i {
  color: #ec4899;
  background: #fdf2f8;
}
.method-group.group-luck .category-tile > i {
  color: #10b981;
  background: #f0fdf4;
}

/* Roulette Animation Support */
.category-tile.roulette-highlight {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.4) !important;
  transform: scale(1.05) translateY(-5px);
  z-index: 100;
}

.category-tile.recommended-highlight {
  border: 3px solid #3b82f6 !important;
  box-shadow: 0 0 50px rgba(59, 130, 246, 0.5) !important;
  transform: scale(1.08) translateY(-10px);
  z-index: 101;
}

.recommend-badge {
    position: absolute;
    top: -15px;
    right: -10px;
    background: linear-gradient(135deg, #6ee7b7 0%, #3b82f6 100%);
    color: #fff;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
    z-index: 110;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 2px solid #fff;
}

/* Footers */
.page-footer-actions {
  margin-top: 6rem;
  text-align: center;
  padding-top: 3rem;
  border-top: 1px dashed #fde68a;
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem 2.5rem;
  background: #fff;
  color: #334155;
  text-decoration: none;
  font-weight: 700;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid #fde68a;
  transition: all 0.4s ease;
  font-family: "Zen Maru Gothic", sans-serif;
}

.btn-back-home:hover {
  transform: translateY(-5px);
  border-color: #f59e0b;
  box-shadow: 0 15px 30px rgba(245, 158, 11, 0.1);
}

/* =========================================
   Layout Override for 3-Column (PC & Split Screen)
   ========================================= */
/* =========================================
   Layout Override: 2-Column Mode (Split Screen / Tablet Landscape)
   Range: 920px - 1199px
   ========================================= */
@media (min-width: 920px) {
    .layout-container {
        display: grid;
        /* Left Sidebar | Main Content */
        grid-template-columns: 240px 1fr; 
        gap: 3rem;
        padding: 4rem 2% 8rem 2%; 
        max-width: none;
        width: 100%;
        margin: 0;
    }

    .sidebar {
        grid-column: 1;
        width: 100% !important;
        order: 1; /* Explicit Order */
        grid-row: 1 / span 2; /* Span across height */
    }

    .main-content {
        grid-column: 2;
        width: 100% !important;
        margin: 0 auto;
        order: 2; /* Explicit Order */
    }

    /* Right sidebar moves to bottom of main content column */
    .sidebar-discovery {
        grid-column: 2; /* Same column as main content */
        width: 100%;
        position: relative; /* No sticky */
        top: 0;
        margin-top: 4rem;
        display: block !important;
        order: 3; /* Explicit Order */
    }
}

/* =========================================
   Layout Override: 3-Column Mode (Full PC)
   Range: 1200px+
   ========================================= */
@media (min-width: 1200px) {
    .layout-container {
        grid-template-columns: 240px 1fr 320px; /* 3 Columns */
        gap: 4rem;
    }

    .sidebar-discovery {
        grid-column: 3; /* Global Right Side */
        position: sticky;
        top: calc(var(--nav-height) + 3rem);
        margin-top: 0;
    }
}

/* Large Screen Optimization */
@media (min-width: 1400px) {
    .layout-container {
        grid-template-columns: 260px 1fr 380px;
        gap: 8rem;
        padding-left: 5%;
        padding-right: 5%;
    }
    .main-content { max-width: 1000px; }
}

/* Response for Mobile & Tablet Portrait (Layout override) */
@media (max-width: 919px) {
    .sidebar-discovery {
        display: block !important;
        width: 100%;
        order: 3; /* Below the main content and navigation sidebar */
        margin-top: 4rem;
        position: relative;
        top: 0;
        animation: fadeInUp 0.8s ease-out both;
    }

    .layout-container {
        display: flex;
        flex-direction: column;
        padding-left: 5%;
        padding-right: 5%;
    }

    .main-content { 
        order: 1; 
        max-width: 100% !important;
        width: 100% !important;
    }
    .sidebar { 
        order: 2; 
        margin-top: 3rem; 
        width: 100% !important;
    }
}

/* =========================================
   Animations
   ========================================= */
.reveal {
  animation: fadeInUp 0.8s ease-out forwards;
  opacity: 0;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Shuffle Animation Support (3D Flap) */
.discovery-cards.shuffling .discovery-card {
    animation: flipVert 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.98) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.reveal-card {
    animation: scaleIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Discovery Sidebar Styling (Consolidated & Fixed) */
.sidebar-discovery .sidebar-widget {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    border-radius: 24px;
    padding: 1.5rem;
    overflow: hidden;
}

.discovery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #e0f2fe;
}

.discovery-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1e293b;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.discovery-header h3 i {
    color: #3b82f6;
}

.btn-shuffle {
    background: #eff6ff;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(59, 130, 246, 0.1);
}

.btn-shuffle:hover {
    background: #3b82f6;
    color: white;
    transform: rotate(180deg);
}

.btn-shuffle.spinning i {
    animation: spin 0.8s ease-in-out;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Flap Card (3D Flip Animation System) */
.discovery-cards {
    perspective: 1000px;
}

.discovery-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid #f1f5f9;
    text-decoration: none;
    display: block;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    color: inherit;
    
    /* Animation Base */
    backface-visibility: hidden;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.discovery-card:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: #3b82f6;
    z-index: 10;
}

/* Shuffle Animation (managed by container class) */
.discovery-cards.shuffling .discovery-card {
    animation: flipVert 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* pulse/Auto-Flap State (managed by single card class) */
.discovery-card.flipping {
    animation: flipVert 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes flipVert {
    0% { transform: rotateX(0deg); opacity: 1; }
    45% { transform: rotateX(-90deg); opacity: 0.5; }
    55% { transform: rotateX(90deg); opacity: 0.5; }
    100% { transform: rotateX(0deg); opacity: 1; }
}

.discovery-card .card-tag {
    font-size: 0.65rem;
    font-weight: 800;
    color: #3b82f6;
    background: #eff6ff;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
    display: inline-block;
}

.discovery-card .card-title {
    font-size: 1rem;
    font-weight: 800;
    color: #1e293b !important;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.discovery-card .card-desc {
    font-size: 0.85rem;
    color: #64748b !important;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sidebar Advice Text Highlight */
.advice-highlight {
  color: #f59e0b;
  font-weight: bold;
}
