/* Apollonian App-Specific Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --color-charcoal: #1A1A1A;
    --color-charcoal-light: #242424;
    --color-teal: #5FC3B2;
    --color-text: #EAEAEA;
    --color-text-muted: #A0A0A0;
    --font-main: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
}

body {
    font-family: var(--font-main);
    background-color: #000;
    color: var(--color-text);
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
}

/* Wrapper visibility control */
#onboarding-wrapper {
    display: none; /* Hidden by default */
    height: 100%;
    width: 100%;
    /* These are needed to center the content since it's no longer on the body */
    justify-content: center;
    align-items: center;
}

.app-container {
    width: 100%;
    height: 100%;
    background-color: var(--color-charcoal);
    display: flex;
    flex-direction: column; /* Changed to column for mobile-first */
    overflow: hidden;
    position: relative;
}
/* New Sidebar Styles */
.sidebar {
    display: none; /* Hidden on mobile by default */
}
.app-content-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--color-charcoal-light);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    position: relative;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    justify-content: space-between;
}

.header-action-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0; /* Prevent from shrinking */
}
.header-action-btn:hover {
    background-color: var(--color-charcoal);
    color: var(--color-text);
}
.header-action-btn svg {
    width: 24px;
    height: 24px;
}

.header-content {
    display: flex;
    align-items: center;
    flex-grow: 1;
    justify-content: space-between; /* This will push button to the right */
}

.mentor-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-title {
    font-size: 1.2rem;
    font-weight: 600;
}
.header-back-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.5rem;
    margin-left: -0.5rem; /* Align icon nicely */
}
.header-back-btn:hover {
    color: var(--color-text);
}
.header-back-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}
.mentor-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-teal);
    display: grid;
    place-items: center;
}
.mentor-avatar svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-charcoal);
}
.mentor-info {
    display: flex;
    flex-direction: column;
}
.mentor-name {
    font-size: 1.2rem;
    font-weight: 600;
}
.mentor-status {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: #4CAF50;
}
.presence-dot {
    width: 8px;
    height: 8px;
    background-color: #4CAF50;
    border-radius: 50%;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.logout-btn:hover {
    background-color: var(--color-charcoal);
    color: var(--color-text);
}

.logout-btn svg {
    width: 24px;
    height: 24px;
}

/* Main Content Styles */
.main-content {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out, visibility 0.2s;
    overflow-y: auto;
}
.page.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* --- Chats Page --- */
.chats-list {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
}

.chat-list-item:hover {
    background-color: var(--color-charcoal-light);
}

.chat-list-item .mentor-avatar {
    flex-shrink: 0;
}

.chat-list-info {
    flex-grow: 1;
    overflow: hidden; /* This is key for text truncation */
}

.chat-list-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.chat-list-preview {
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.chat-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.chat-bubble {
    padding: 0.75rem 1rem;
    border-radius: 18px;
    max-width: 80%;
    line-height: 1.5;
    font-size: 1rem;
    opacity: 0;
    transform: translateY(10px);
    animation: popIn 0.4s ease forwards;
}
@keyframes popIn { to { opacity: 1; transform: translateY(0); } }

.user {
    background: var(--color-teal);
    color: var(--color-charcoal);
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}
.mentor {
    background: var(--color-charcoal-light);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}
.typing-indicator {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: var(--color-text-muted);
    border-radius: 50%;
    animation: typing 1s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

.smart-reply-area {
    padding: 0 1rem 0.5rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--color-charcoal-light) transparent;
}
.smart-reply-area::-webkit-scrollbar { height: 4px; }
.smart-reply-area::-webkit-scrollbar-track { background: transparent; }
.smart-reply-area::-webkit-scrollbar-thumb { background: var(--color-charcoal-light); border-radius: 2px; }

.smart-reply-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-teal);
    color: var(--color-teal);
    background: transparent;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}

.input-area {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background-color: var(--color-charcoal-light);
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.text-input {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    background: var(--color-charcoal);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: var(--color-text);
    font-size: 1rem;
}
.text-input:focus {
    outline: none;
    border-color: var(--color-teal);
}
.send-btn, .prompt-btn {
    background-color: var(--color-teal);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
}
.send-btn svg, .prompt-btn svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-charcoal);
}
.prompt-btn {
    background-color: var(--color-charcoal);
    border: 1px solid rgba(255,255,255,0.2);
}
.prompt-btn svg {
    stroke: var(--color-teal);
}
.input-area.disabled {
    opacity: 0.5;
}
.input-area.disabled .text-input,
.input-area.disabled .send-btn,
.input-area.disabled .prompt-btn {
    pointer-events: none;
    background-color: var(--color-charcoal);
}

/* --- Explore Page --- */
.explore-content {
    padding: 1.5rem;
}
.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
    padding: 0 0.5rem;
    text-align: left;
}
.card {
    background: var(--color-charcoal-light);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255,255,255,0.1);
    opacity: 0;
    transform: translateY(20px);
}

.featured-mentor-card {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.featured-mentor-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.featured-mentor-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--color-coral);
    flex-shrink: 0;
    display: grid;
    place-items: center;
}
.featured-mentor-avatar svg {
    width: 40px;
    height: 40px;
    stroke: var(--color-charcoal);
}
.featured-mentor-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}
.featured-mentor-info p {
    color: var(--color-text-muted);
}
.mentor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2.5rem;
}
.mentor-card-explore {
    background: var(--color-charcoal-light);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.mentor-card-explore:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}
.mentor-avatar-explore {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--color-teal);
    margin: 0 auto 1rem auto;
    display: grid;
    place-items: center;
}
.mentor-avatar-explore svg {
    width: 32px;
    height: 32px;
    stroke: var(--color-charcoal);
}
.mentor-name-explore {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.mentor-specialty-explore {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* --- Journey Page --- */
.content-padding {
    padding: 1.5rem;
}
.snapshot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--color-charcoal);
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
}
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.9rem; color: var(--color-text-muted); }

#chart-container {
    position: relative;
    min-height: 250px; /* Ensure container has a height */
}

#chart-empty-state {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
}

@media (min-width: 1024px) {
    .journey-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
        align-items: flex-start;
    }
}

.activity-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.activity-list-item:last-child {
    border-bottom: none;
}
.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-charcoal);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.activity-icon svg { width: 20px; height: 20px; stroke: var(--color-teal); }
.activity-info h4 { font-weight: 500; }
.activity-info p { font-size: 0.875rem; color: var(--color-text-muted); }
.progress-item { margin-bottom: 1.5rem; text-align: left;}
.progress-label { font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--color-text-muted); display: flex; justify-content: space-between; }
.progress-bar-bg { width: 100%; height: 8px; background: var(--color-charcoal); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--color-coral); border-radius: 4px; width: 0%; transition: width 1s ease-in-out; }

/* --- Profile Page --- */
.profile-user-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--color-charcoal-light);
    display: grid;
    place-items: center;
    margin-bottom: 0.5rem;
}
.profile-avatar svg { width: 40px; height: 40px; stroke: var(--color-teal); }
.profile-name { font-size: 1.5rem; font-weight: 600; }
.profile-email { color: var(--color-text-muted); }

.profile-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logout-btn {
    text-align: center;
    padding: 1rem;
    color: var(--color-coral);
    background: transparent;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--color-charcoal);
    border-radius: 28px;
    transition: .4s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}
input:checked + .slider { background-color: var(--color-teal); }
input:checked + .slider:before { transform: translateX(22px); }

/* --- Profile Page --- */
.profile-content {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    justify-content: center; /* Add this for vertical centering */
    height: 100%; /* Ensure it takes full height of parent */
}

.profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-color: var(--color-charcoal-light);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.profile-avatar svg {
    width: 45px;
    height: 45px;
    color: var(--color-primary);
}

#profile-name {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

#profile-name-container {
    margin-bottom: 1.5rem;
}

/* New Profile Name Editing Styles */
.profile-name-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    margin-bottom: 0.25rem;
}

.edit-name-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.edit-name-btn:hover {
    background-color: var(--color-charcoal);
    color: var(--color-text);
}

.edit-name-btn svg {
    width: 20px;
    height: 20px;
}

.edit-name-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.edit-name-input {
    font-family: var(--font-main);
    background: var(--color-charcoal);
    border: 1px solid var(--color-charcoal-light);
    border-radius: 8px;
    color: var(--color-text);
    font-size: 1.8rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    text-align: center;
    width: 100%;
    max-width: 300px;
}
.edit-name-input:focus {
    outline: none;
    border-color: var(--color-teal);
}

.edit-name-actions {
    display: flex;
    gap: 1rem;
}

.form-action-btn {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--color-charcoal-light);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    background: none;
    color: var(--color-text-muted);
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.form-action-btn.primary {
    background-color: var(--color-teal);
    border-color: var(--color-teal);
    color: var(--color-charcoal);
}
.form-action-btn:hover {
    border-color: var(--color-text);
    color: var(--color-text);
}
.form-action-btn.primary:hover {
    background-color: #4db3a3; /* A slightly darker teal for hover */
    border-color: #4db3a3;
    color: var(--color-charcoal);
}


#profile-email {
    color: var(--color-text-muted);
    font-size: 1rem;
}

.logout-btn-profile {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-top: 1.5rem;
    padding: 0.5rem;
    transition: color 0.2s;
}

.logout-btn-profile:hover {
    color: var(--color-error);
}


#profile-page {
    justify-content: center;
}

/* Tab Bar */
.tab-bar {
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    background-color: var(--color-charcoal-light);
    border-top: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}
.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    padding: 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    transition: color 0.2s;
}
.tab-item.active {
    color: var(--color-text);
}
.tab-item svg {
    width: 28px;
    height: 28px;
}
.tab-item:focus-visible {
    outline: 2px solid var(--color-primary);
    border-radius: 8px;
}

.placeholder-page {
    display: grid;
    place-items: center;
    height: 100%;
    padding: 2rem;
    text-align: center;
}

@media (min-width: 768px) {
    body {
        padding: 2rem;
    }
    .app-container {
        border-radius: 24px;
        border: 1px solid #333;
        box-shadow: 0 20px 50px rgba(0,0,0,0.5);
        max-height: 90vh;
    }

    /* Desktop layout adjustments */
    .app-container {
        flex-direction: row; /* Switch to row layout for sidebar */
    }
    .sidebar {
        display: flex;
        flex-direction: column;
        width: 260px;
        background-color: var(--color-charcoal-light);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        flex-shrink: 0;
        padding: 1.5rem;
    }
    .sidebar-header {
        margin-bottom: 2rem;
    }
    .logo {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    .logo img {
        width: 32px;
        height: 32px;
    }
    .logo span {
        font-size: 1.5rem;
        font-weight: 600;
    }
    .sidebar-nav {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .nav-item {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 0.75rem 1rem;
        border-radius: 8px;
        color: var(--color-text-muted);
        text-decoration: none;
        font-size: 1rem;
        font-weight: 500;
        border: none;
        background: none;
        cursor: pointer;
        text-align: left;
        transition: background-color 0.2s, color 0.2s;
    }
    .nav-item:hover {
        background-color: var(--color-charcoal);
    }
    .nav-item.active {
        background-color: var(--color-charcoal);
        color: var(--color-text);
    }
    .nav-item svg {
        width: 24px;
        height: 24px;
    }
    .tab-bar {
        display: none; /* Hide tab bar on desktop */
    }
}
