/* Page Specific CSS for self_affirmation.html */

/* --- Theme Variables --- */
:root {
  --sa-primary: #f06292; /* Vivid Pink */
  --sa-secondary: #fce4ec; /* Soft Pink Background */
  --sa-accent: #fbc02d; /* Gold */
  --sa-text: #4a4a4a;
  --sa-card-bg: #ffffff;
  --sa-gradient: linear-gradient(135deg, #fff1eb 0%, #ace0f9 100%);
  --sa-hero-gradient: linear-gradient(to bottom, #fad0c4 0%, #ffd1ff 100%);
}

/* --- Base Layout & Typography --- */
body {
  background-color: var(
    --secondary-bg
  ); /* Use base.css variable if available, or override */
  font-family: "Kaisei Opti", "Hiragino Mincho ProN", serif; /* Elegant font */
}

.main-content {
  overflow: visible; /* Allow effects to spill over */
}

h1,
h2,
h3 {
  font-family: "Kaisei Opti", serif;
  color: var(--sa-text);
}

/* --- Hero Section --- */
.hero-wrapper {
  position: relative;
  padding: 6rem 2rem 4rem;
  text-align: center;
  background: var(--sa-hero-gradient);
  border-radius: 30px;
  margin-bottom: 4rem;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(240, 98, 146, 0.2);
}

.hero-wrapper::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.4) 0%,
    transparent 70%
  );
  animation: rotateLight 20s linear infinite;
  pointer-events: none;
}

@keyframes rotateLight {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-title {
  font-size: 3rem;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, #e91e63, #9c27b0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
}

.hero-subtitle {
  font-size: 1.2rem;
  color: #555;
  margin-bottom: 3rem;
}

/* --- Name Input Area --- */
.name-input-container {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 20px;
  display: inline-block;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  max-width: 90%;
  width: 500px;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.input-label {
  display: block;
  margin-bottom: 1rem;
  font-weight: bold;
  color: var(--sa-primary);
}

.name-input-wrapper {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

#user-name-input {
  flex: 1;
  padding: 1rem;
  border: 2px solid #ddd;
  border-radius: 50px;
  font-size: 1.1rem;
  outline: none;
  transition: all 0.3s;
  text-align: center;
}

#user-name-input:focus {
  border-color: var(--sa-primary);
  box-shadow: 0 0 0 4px rgba(240, 98, 146, 0.2);
}

.start-btn {
  padding: 1rem 2rem;
  background: var(--sa-primary);
  color: white;
  border: none;
  border-radius: 50px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4);
}

.start-btn:hover {
  background: #d81b60;
  transform: translateY(-2px);
}

.user-name-placeholder {
  font-weight: bold;
  color: var(--sa-text);
  background: rgba(251, 192, 45, 0.2); /* Gold background */
  padding: 0 6px;
  border-radius: 4px;
  border-bottom: 2px solid rgba(251, 192, 45, 0.5); /* Gold border */
}

/* --- Content Sections --- */
.content-section {
  margin-bottom: 6rem;
}

.section-card {
  background: var(--sa-card-bg);
  padding: 3rem;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s;
  border: 1px solid rgba(0, 0, 0, 0.02);
}

.section-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
}

.section-title-wrapper {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.section-title-wrapper::after {
  content: "";
  display: block;
  width: 60px;
  height: 4px;
  background: var(--sa-accent);
  margin: 1rem auto 0;
  border-radius: 2px;
}

.section-icon {
  font-size: 2.5rem;
  color: var(--sa-accent);
  margin-bottom: 1rem;
  display: inline-block;
}

/* --- Affirmation List Card --- */
.affirmation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.affirmation-item {
  background: linear-gradient(135deg, #fff 0%, #fffbf0 100%);
  padding: 1.5rem;
  border-radius: 16px;
  border: 2px solid #fff5e6;
  text-align: center;
  transition: all 0.3s;
  position: relative;
  cursor: default;
}

.affirmation-item::before {
  content: "✨";
  font-size: 1.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.affirmation-item:hover {
  transform: scale(1.03);
  border-color: var(--sa-accent);
  box-shadow: 0 8px 20px rgba(251, 192, 45, 0.2);
}

/* --- Action Checklist --- */
.action-list {
  list-style: none;
  padding: 0;
}

.action-item {
  background: white;
  margin-bottom: 1rem;
  padding: 1.5rem;
  border-radius: 12px;
  border-left: 6px solid var(--sa-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s;
}

.action-item:hover {
  transform: translateX(5px);
}

.check-icon {
  color: var(--sa-primary);
  font-size: 1.2rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }
  .hero-wrapper {
    padding: 4rem 1rem;
  }
  .section-card {
    padding: 1.5rem;
  }
}

/* --- Oracle Feature --- */
.message-oracle-wrapper {
    margin-top: 3rem;
    background: linear-gradient(135deg, #fffbeb 0%, #fff 100%);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    border: 2px dashed var(--sa-accent);
}

.message-oracle-wrapper h4 {
    color: #f9a825;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.oracle-btn {
    margin-top: 1.5rem;
    padding: 1rem 3rem;
    background: linear-gradient(45deg, #fbc02d, #ff6f00);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 111, 0, 0.3);
    transition: all 0.3s;
}

.oracle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 111, 0, 0.4);
}

/* Modal */
.oracle-modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5); 
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.oracle-modal.show {
    display: flex;
    opacity: 1;
}

.oracle-modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 3rem 2rem;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 4px solid #fff3e0;
}

.oracle-modal.show .oracle-modal-content {
    transform: scale(1);
    margin: auto; /* Center with flexbox */
}

.close-modal {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--sa-primary);
}

.oracle-icon {
    font-size: 4rem;
    color: var(--sa-accent);
    margin-bottom: 1rem;
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.oracle-result {
    font-size: 1.5rem;
    font-weight: bold;
    color: #444;
    margin: 2rem 0;
    line-height: 1.4;
    padding: 1rem;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.oracle-note {
    font-size: 0.9rem;
    color: #888;
}

/* --- Text Reveal Animation --- */
.poetic-line {
    display: block; /* Each line on its own */
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1.5s ease-out, transform 1.5s ease-out; /* Slow, gentle ease */
    margin-bottom: 0.8rem; /* Space between lines */
    line-height: 1.8;
}

.poetic-line.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Power Growth Visualization --- */
.power-growth-visual {
    margin-top: 2rem;
    text-align: center;
}

.power-text {
    font-weight: bold;
    color: #888;
}

.power-text.highlight {
    color: var(--sa-accent);
    font-size: 1.2em;
}

.power-bars-container {
    display: flex;
    justify-content: center;
    align-items: flex-end; /* Align bars to bottom */
    gap: 2rem;
    height: 200px;
    margin-top: 2rem;
    padding-bottom: 20px;
}

.power-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    width: 60px;
}

.power-bar {
    width: 100%;
    background: #e0e0e0;
    border-radius: 8px 8px 0 0;
    height: 0; /* Start at 0 for animation */
    transition: height 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.level-50 {
    background: #b0bec5; /* Muted */
}

.level-80 {
    background: linear-gradient(to top, #f48fb1, #f06292); /* Healthy Pink */
}

.level-120 {
    background: linear-gradient(to top, #ffd54f, #ffca28); /* Gold */
    box-shadow: 0 0 15px rgba(255, 202, 40, 0.5);
    z-index: 1;
}

.power-bar.grow {
    height: var(--final-height); /* Set via JS */
}

.overflow-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: inherit;
    filter: blur(10px);
    opacity: 0.6;
    animation: glow-pulse 2s infinite alternate;
}

@keyframes glow-pulse {
    0% { opacity: 0.4; transform: scale(1); }
    100% { opacity: 0.8; transform: scale(1.1); }
}

.power-label {
    margin-top: 0.5rem;
    font-weight: bold;
    color: #666;
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
}

.power-label.highlight {
    color: #fbc02d;
    font-size: 1.5rem;
}

/* --- Reveal Button --- */
.reveal-power-btn {
    margin-top: 1rem;
    padding: 1rem 3rem;
    background: white;
    color: var(--sa-primary);
    border: 2px solid var(--sa-primary);
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.reveal-power-btn:hover {
    background: var(--sa-primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(240, 98, 146, 0.3);
}

.power-visual-area {
    transition: opacity 0.5s ease;
}

/* --- Affirmation Flip Cards --- */
.affirmation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.affirmation-card-flip {
    background-color: transparent;
    width: 100%;
    height: 180px; /* Fixed height for consistency */
    perspective: 1000px; /* Essential for 3D flip */
    cursor: pointer;
    transition: transform 0.3s ease; /* Smooth lift */
}

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border-radius: 12px;
}

.affirmation-card-flip.flipped .flip-inner {
    transform: rotateY(180deg);
}

.flip-front, .flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* Front Styling (Affirmation) */
.flip-front {
    background: linear-gradient(135deg, #fff3e0, #ffebee);
    border: 2px solid #ffe0b2;
    color: var(--sa-text);
}

.flip-front i {
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
    color: var(--sa-accent);
    opacity: 0.8;
}

.flip-front p {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--sa-primary);
    margin: 0;
    line-height: 1.5;
}

/* Back Styling (Advice) */
.flip-back {
    background-color: white;
    border: 2px solid var(--sa-primary);
    transform: rotateY(180deg); /* Pre-rotated */
    color: var(--sa-text);
    font-family: 'Kaisei Opti', serif;
    box-shadow: inset 0 0 20px rgba(240, 98, 146, 0.1);
}

.advice-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.advice-content i {
    font-size: 1.5rem;
    color: #ffd600; /* Lightbulb gold */
}

.advice-content p {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

/* --- Quote Box Styling --- */
.quote-banner {
    margin: 1.5rem 0;
    padding: 2rem;
    background: #fffaf0; /* Creamy background */
    border: 3px solid #f8bbd0; /* Pastel Pink border */
    border-radius: 15px;
    position: relative;
    box-shadow: 0 4px 15px rgba(240, 98, 146, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.quote-banner::before, .quote-banner::after {
    /* Decorative dots/corners */
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ffe082; /* Pastel Gold */
    border-radius: 50%;
}

.quote-banner::before { top: 10px; left: 10px; }
.quote-banner::after { bottom: 10px; right: 10px; }

.quote-icon {
    font-size: 1.5rem;
    color: #f48fb1; /* Softer icon pink */
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.quote-text {
    font-family: 'Kaisei Opti', serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--sa-text);
    font-style: italic;
}

.quote-author {
    align-self: flex-end;
    font-weight: bold;
    color: #ec407a; /* Softer text pink */
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* Hover Effect for desktop hint */
@media (hover: hover) {
    .affirmation-card-flip:hover {
        transform: translateY(-7px); /* Clear lift effect */
    }

    .affirmation-card-flip:hover .flip-inner {
        box-shadow: 0 15px 25px rgba(240, 98, 146, 0.25); /* Deep glow shadow */
    }

    .affirmation-card-flip:hover .flip-front {
        background: linear-gradient(135deg, #fff8e1, #ffcdd2);
    }

    .affirmation-card-flip:hover .flip-front i {
        transform: scale(1.2) rotate(10deg); /* Playful icon pop */
        transition: transform 0.3s ease;
    }
}

/* --- Interactive Action List --- */
.interactive-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.action-card-interactive {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    border: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden; /* For smooth max-height animation on collapse */
}

.action-card-interactive:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(240, 98, 146, 0.1);
}

.action-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space for icon */
    gap: 0.8rem;
    margin-bottom: 0; /* Removed margin-bottom here to handle collapse state */
    padding-bottom: 0.8rem; /* Keep padding for header look */
    border-bottom: 2px solid #fff3e0;
    cursor: pointer; /* Indicate clickability */
    user-select: none;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-grow: 1;
}

.toggle-icon {
    font-size: 1.2rem;
    color: #ccc;
    transition: transform 0.3s ease;
}

.action-header i {
    font-size: 1.4rem;
    color: var(--sa-accent);
}

.toggle-icon {
    /* Override specific icon color for chevron */
    color: #bdbdbd;
}

.action-header h4 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--sa-text);
    line-height: 1.4;
}

/* Accordion Logic */
.action-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    
    /* Collapsed State Default */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.4s ease, margin-top 0.4s ease;
    margin-top: 0;
}

/* Expanded State */
.action-card-interactive.expanded .action-inputs {
    max-height: 600px; /* Arbitrary large height */
    opacity: 1;
    margin-top: 1.5rem;
}

.action-card-interactive.expanded .toggle-icon {
    transform: rotate(180deg);
    color: var(--sa-primary);
}

.action-card-interactive.expanded .action-header {
    /* Keep border visible in expanded state */
}

/* Special Case: Checkbox cards shouldn't have pointer cursor if not collapsible */
.checkbox-card .action-header {
    cursor: default;
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.action-input {
    width: 100%;
    border: none;
    border-bottom: 1px solid #ddd;
    padding: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
    background: transparent;
}

.action-input:focus {
    outline: none;
    border-bottom: 2px solid var(--sa-primary);
    background: rgba(240, 98, 146, 0.05);
}

.action-input::placeholder {
    color: #ccc;
    font-size: 0.9rem;
}

/* Custom Checkbox Styling */
.checkbox-card {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff8e1; /* Soft yellow background */
    border: none;
}

.custom-checkbox-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    user-select: none;
    width: 100%;
}

.action-checkbox {
    display: none; /* Hide default checkbox */
}

.checkmark {
    width: 30px;
    height: 30px;
    background-color: white;
    border: 2px solid var(--sa-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox-text {
    font-weight: bold;
    color: #8d6e63;
    line-height: 1.5;
    flex-grow: 1;
}

/* Checked State */
.custom-checkbox-label input:checked ~ .checkmark {
    background-color: var(--sa-primary);
    border-color: var(--sa-primary);
    transform: scale(1.1);
}

/* Card highlight when completed */
.action-card-interactive:has(input:checked) {
    border-color: var(--sa-primary);
    background: #fce4ec; /* Softest pink */
}

/* Small inline checkbox for reward card */
/* --- Interactive Buttons (SNS & Chant) --- */
.ok-message-container {
    text-align: center;
    padding: 2rem;
    background: #fff8e1;
    border-radius: 12px;
    border: 2px dashed #ffe082;
}

.ok-text {
    font-size: 3rem;
    font-weight: 900;
    color: #ffb300;
    font-family: 'Inter', sans-serif;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.5);
}

.ok-subtext {
    color: #8d6e63;
    font-weight: bold;
    margin: 0;
}

.chant-section {
    text-align: center;
    padding: 1rem;
}

.counter-display-small {
    font-size: 3.5rem;
    font-weight: bold;
    color: var(--sa-primary);
    margin-bottom: 1rem;
    transition: transform 0.2s;
}

.counter-btn-small {
    background: linear-gradient(135deg, #f48fb1, #ec407a);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(236, 64, 122, 0.3);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.counter-btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(236, 64, 122, 0.4);
    background: linear-gradient(135deg, #f06292, #d81b60);
}

.counter-btn-small:active {
    transform: scale(0.95);
}

.chant-congrats {
    margin-top: 1.5rem;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--sa-primary);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.5s ease;
}

.chant-congrats.show {
    opacity: 1;
    transform: translateY(0);
}

/* --- Refactored Inline Styles --- */
.healing-particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.encourage-box {
    background: var(--sa-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 2rem;
}

.encourage-title {
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--sa-primary);
}

.encourage-signature {
    margin-top: 1rem;
    font-size: 1.2rem;
    text-align: right;
    color: var(--sa-accent);
    font-weight: bold;
}

.quote-banner.secondary {
    margin-top: 1rem;
}

.affirmation-tips-text {
    margin-top: 2rem;
}

