/* Basic Resets & Global Styles */
:root {
    --primary-gradient-start: #a855f7; /* Purple */
    --primary-gradient-end: #6366f1;   /* Blue */
    --background-light: #f7f3ff;      /* Very light purple/pink tint for default page backgrounds */
    --text-dark: #333;
    --text-medium: #555;
    --text-light: #888;
    --card-background: #ffffff;
    --border-color: #e0e0e0;
    --accent-color: #20c997; /* Teal/Mint Green for accents */
    --button-hover-darken: #8c3fcd;
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Lato', sans-serif;
    color: var(--text-dark);
    background: var(--background-light); /* Default background for pages without specific background images */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    color: var(--text-dark);
    margin-bottom: 1.2rem;
}

h2 {
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.heart-icon {
    color: #ff69b4; /* Pink */
}

/* Navbar */
.navbar {
    background: linear-gradient(to right, var(--primary-gradient-start), var(--primary-gradient-end));
    padding: 1rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    box-shadow: 0 2px 10px var(--shadow-medium);
    z-index: 1000; /* Ensure navbar stays on top */
}

.navbar .logo {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: 0.5px;
}

.navbar nav ul {
    display: flex;
    gap: 2rem;
}

.navbar nav ul li a {
    color: #fff;
    font-weight: 400;
    font-size: 1.1rem;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.3s ease;
}

.navbar nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    background-color: var(--accent-color);
    bottom: -5px;
    left: 0;
    transition: width 0.3s ease;
}

.navbar nav ul li a:hover::after,
.navbar nav ul li a.active::after {
    width: 100%;
}

.navbar nav ul li a:hover {
    color: var(--accent-color); /* Lighter color on hover */
}

/* General Page Content Wrapper */
.page-content {
    flex-grow: 1; /* Allows content to take up available space */
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content horizontally by default */
    justify-content: flex-start; /* Align content to top by default */
}

/* Card Styling (for chat, journal entries, etc.) */
.card {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: 0 4px 20px var(--shadow-light);
    margin-bottom: 2rem;
    width: 100%;
    max-width: 800px; /* Max width for cards for better readability */
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.9rem 2.2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    border: none;
    line-height: 1; /* For consistent button height */
}

.primary-btn {
    background: linear-gradient(to right, var(--primary-gradient-start), var(--primary-gradient-end));
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    background: linear-gradient(to right, var(--button-hover-darken), var(--primary-gradient-end));
}

/* Input Fields */
.input-field {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Lato', sans-serif;
    font-size: 1rem;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-field:focus {
    border-color: var(--primary-gradient-start);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

textarea.input-field {
    min-height: 120px;
    resize: vertical;
}

/* --- Home Page Specific Styles --- */
.home-page-body {
    /* Replace with your image URL or path */
    background-image: url('https://images.unsplash.com/photo-1544198365-f5d60b6d601b?q=80&w=2874&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* Keeps background fixed when scrolling */
    position: relative;
    z-index: 1; /* Establishes a stacking context for the overlay */
    overflow-y: auto; /* Allow scrolling if content overflows */
}

/* Overlay for text readability on homepage */
.home-page-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* A soft white-to-transparent gradient overlay */
    background: linear-gradient(to top, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0.4));
    z-index: -1; /* Puts the overlay behind the content */
}

.home-content {
    display: flex;
    align-items: center; /* Vertically center content */
    justify-content: center; /* Horizontally center content */
    min-height: calc(100vh - 80px); /* Full viewport height minus navbar height */
    text-align: center;
    z-index: 2; /* Ensure welcome section is above the overlay */
    padding: 2rem 1rem; /* Add padding for smaller screens */
}

.welcome-section {
    background-color: var(--card-background); /* White background for the card */
    padding: 4rem 3rem;
    border-radius: 15px;
    box-shadow: 0 8px 30px var(--shadow-medium);
    max-width: 650px; /* Adjust max width as needed */
    width: 100%; /* Ensure it takes full width up to max-width */
    animation: fadeInScale 0.8s ease-out; /* Subtle entrance animation */
}

.welcome-section h1 {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-gradient-start); /* Purple color for main heading */
    margin-bottom: 1rem;
    line-height: 1.2;
}

.welcome-section p {
    font-size: 1.3rem;
    color: var(--text-medium);
    margin-bottom: 2.5rem;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- General Page Card Styling (for other pages) --- */
/* (These styles are included for completeness of style.css but primarily affect other pages) */
.chat-page, .mood-page, .journal-page, .meditation-page {
    justify-content: flex-start; /* Align content to top for other pages */
    align-items: center; /* Center horizontally by default */
}

.chat-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 700px;
}

.chat-container h2 {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 2rem;
    color: var(--primary-gradient-start);
    margin-bottom: 0.5rem;
}

.chat-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    max-height: 400px; /* Scrollable chat history */
    overflow-y: auto;
    background-color: #fcfcff;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.message {
    max-width: 80%;
    padding: 0.8rem 1.2rem;
    border-radius: 20px;
    line-height: 1.5;
    word-wrap: break-word;
}

.user-message {
    background-color: var(--primary-gradient-end);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.bot-message {
    background-color: var(--background-light);
    color: var(--text-dark);
    align-self: flex-start;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 5px;
}

.chat-input-area {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.chat-input-area .input-field {
    flex-grow: 1;
}

.send-btn {
    padding: 0.9rem 1.5rem;
}

/* --- Mood Page Specific Styles --- */
.mood-page h2 {
    margin-bottom: 2.5rem;
}

.mood-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    width: 100%;
    max-width: 900px;
    margin-bottom: 2rem;
}

.mood-card {
    background-color: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 15px var(--shadow-light);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
    border: 2px solid transparent;
}

.mood-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px var(--shadow-medium);
}

.mood-card.selected {
    border-color: var(--accent-color);
    box-shadow: 0 8px 25px rgba(32, 201, 151, 0.3);
}

.mood-card .emoji {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.mood-card p {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-dark);
}

.mood-note {
    font-size: 1rem;
    color: var(--text-medium);
    margin-top: 1rem;
    text-align: center;
}

/* --- Journal Page Specific Styles --- */
.journal-page {
    align-items: flex-start;
    gap: 2.5rem;
}

.journal-section {
    width: 100%;
    max-width: 800px;
}

.journal-section h2 {
    text-align: left;
    font-size: 2rem;
    color: var(--primary-gradient-start);
    margin-bottom: 1.5rem;
}

.journal-input-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
}

.save-btn {
    align-self: flex-end;
}

.journal-entry {
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 5px solid var(--primary-gradient-start);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.journal-entry:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.entry-date {
    font-size: 0.95rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.journal-entry p {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-medium);
}

/* --- Meditation Page Specific Styles --- */
.meditation-page {
    justify-content: center;
    align-items: center;
}

.breathing-exercise {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    max-width: 600px;
    width: 100%;
    padding: 2.5rem;
    background-color: var(--card-background);
    border-radius: 15px;
    box-shadow: 0 8px 30px var(--shadow-medium);
    text-align: center;
}

.breathing-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-gradient-start);
    margin-bottom: 0.5rem;
}

.breathing-circle {
    width: 200px;
    height: 200px;
    background: linear-gradient(to top right, var(--primary-gradient-start), var(--primary-gradient-end));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    transition: transform 4s ease-in-out, background-color 2s ease-in-out;
    animation: pulse 8s infinite ease-in-out alternate;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        background: linear-gradient(to top right, var(--primary-gradient-start), var(--primary-gradient-end));
    }
    50% {
        transform: scale(1.1);
        background: linear-gradient(to top right, var(--accent-color), var(--primary-gradient-start));
    }
    100% {
        transform: scale(0.9);
        background: linear-gradient(to top right, var(--primary-gradient-start), var(--primary-gradient-end));
    }
}

.affirmation {
    font-size: 1.2rem;
    font-style: italic;
    color: var(--text-medium);
    margin-top: 1rem;
    line-height: 1.5;
}

.music-player-option {
    margin-top: 2rem;
    width: 100%;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
}

.music-player-option p {
    font-size: 1.05rem;
    color: var(--text-medium);
    margin-bottom: 1rem;
}

.music-player {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--background-light);
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.music-player .play-btn,
.music-player .volume-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-gradient-start);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.music-player .play-btn:hover,
.music-player .volume-btn:hover {
    transform: scale(1.1);
}

.progress-bar-container {
    flex-grow: 1;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

.progress-bar {
    width: 25%; /* Example: 25% played */
    height: 100%;
    background: linear-gradient(to right, var(--accent-color), var(--primary-gradient-end));
    border-radius: 4px;
}

.time-display {
    font-size: 0.9rem;
    color: var(--text-light);
    white-space: nowrap;
}


/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        padding: 1rem 1.5rem;
    }
    .navbar nav ul {
        gap: 1rem;
        margin-top: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    .navbar .logo {
        font-size: 1.5rem;
    }

    .page-content {
        padding: 2rem 1rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    .welcome-section {
        padding: 2.5rem 1.5rem;
    }
    .welcome-section h1 {
        font-size: 2.5rem;
    }
    .welcome-section p {
        font-size: 1.1rem;
    }

    .chat-input-area {
        flex-direction: column;
    }
    .send-btn {
        width: 100%;
        padding: 0.8rem;
    }
    .message {
        max-width: 90%;
    }

    .mood-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 1rem;
    }
    .mood-card .emoji {
        font-size: 3rem;
    }
    .mood-card p {
        font-size: 1rem;
    }

    .journal-section h2 {
        font-size: 1.8rem;
        text-align: center;
    }

    .breathing-text {
        font-size: 2rem;
    }
    .breathing-circle {
        width: 160px;
        height: 160px;
    }
    .affirmation {
        font-size: 1rem;
    }
    .music-player {
        flex-wrap: wrap;
        justify-content: center;
    }
    .progress-bar-container {
        width: 100%;
        order: 3;
        margin-top: 0.5rem;
    }
    .time-display {
        order: 4;
        flex-basis: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .navbar nav ul {
        flex-direction: column;
        align-items: center;
    }
    .navbar nav ul li a {
        font-size: 1rem;
    }
    .welcome-section {
        padding: 2rem 1rem;
    }
    .welcome-section h1 {
        font-size: 2rem;
    }
    .welcome-section p {
        font-size: 1rem;
    }
    .btn {
        font-size: 0.95rem;
        padding: 0.7rem 1.5rem;
    }

    .mood-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
  .chat-input-area {
      flex-direction: column;
      align-items: stretch;
  }
  .chat-input-area .input-field {
      width: 100%;
  }
  .send-btn {
      width: 100%;
  }
}
