/* =============================================
   MindCare - AI Mental Health Assistant
   Main Stylesheet
   ============================================= */

/* CSS Variables */
:root {
    --primary: #25636C;
    --secondary: #388e3c;
    --accent1: #81d4fa;
    --accent2: #a5d6a7;
    --light: #f8fafc;
    --dark: #1e293b;
    --text: #334155;
    --white: #ffffff;
    --border: #eeeeee;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 5px 20px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
    --gradient-primary: linear-gradient(90deg, var(--accent1) 0%, var(--accent2) 100%);
    --gradient-bg: linear-gradient(135deg, #f0f9ff 0%, #f0fdf0 100%);
    --radius-sm: 8px;
    --radius-md: 15px;
    --radius-lg: 20px;
    --radius-full: 50px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gradient-bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =============================================
   Header & Navigation
   ============================================= */
header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    padding: 0.8rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary);
}

.logo i {
    color: var(--accent2);
}

nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: color 0.3s;
    position: relative;
}

nav a:hover {
    color: var(--primary);
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s;
}

nav a:hover::after {
    width: 100%;
}

/* Auth Buttons */
.auth-buttons {
    display: flex;
    gap: 1rem;
}

.auth-btn {
    padding: 0.6rem 1.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.login-btn {
    background: transparent;
    border: 2px solid var(--accent1);
    color: var(--primary);
}

.login-btn:hover {
    background: var(--accent1);
    color: white;
}

.signup-btn {
    background: var(--gradient-primary);
    border: none;
    color: white;
    box-shadow: 0 4px 10px rgba(129, 212, 250, 0.3);
}

.signup-btn:hover {
    box-shadow: 0 6px 15px rgba(129, 212, 250, 0.4);
    transform: translateY(-2px);
}

/* =============================================
   Main Layout
   ============================================= */
.container {
    display: flex;
    flex: 1;
}

/* =============================================
   Sidebar
   ============================================= */
.sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem 1rem;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.sidebar-section h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.sidebar-links a {
    text-decoration: none;
    color: var(--text);
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.sidebar-links a:hover {
    background: rgba(129, 212, 250, 0.1);
    color: var(--primary);
}

.sidebar-links a i {
    width: 20px;
    color: var(--accent1);
}

/* =============================================
   Main Content
   ============================================= */
.main-content {
    flex: 1;
    padding: 2rem;
}

/* =============================================
   Hero Section
   ============================================= */
.hero {
    background: linear-gradient(135deg, rgba(179, 229, 252, 0.2) 0%, rgba(165, 214, 167, 0.2) 100%);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, var(--accent1) 0%, var(--accent2) 100%);
    border-radius: 50%;
    opacity: 0.1;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.hero p {
    font-size: 1.3rem;
    color: var(--secondary);
    margin-bottom: 2.5rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-btn {
    padding: 1rem 2.5rem;
    border-radius: var(--radius-full);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.primary-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(44, 101, 85, 0.2);
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(44, 101, 85, 0.3);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary);
    border: 2px solid var(--accent2);
}

.secondary-btn:hover {
    background: rgba(165, 214, 167, 0.1);
    transform: translateY(-3px);
}

/* =============================================
   Section Titles
   ============================================= */
.section-title {
    text-align: center;
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* =============================================
   Features Grid
   ============================================= */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.feature-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--accent1) 0%, var(--accent2) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.8rem;
    color: white;
}

.feature-card h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--text);
}

/* =============================================
   Testimonials
   ============================================= */
.testimonials {
    background: linear-gradient(135deg, rgba(179, 229, 252, 0.1) 0%, rgba(165, 214, 167, 0.1) 100%);
    padding: 4rem 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 4rem;
}

.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.testimonial-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.testimonial-text {
    font-style: italic;
    margin-bottom: 1.5rem;
    color: var(--text);
    position: relative;
    padding: 0 1.5rem;
}

.testimonial-text::before,
.testimonial-text::after {
    content: '"';
    font-size: 3rem;
    color: var(--accent1);
    opacity: 0.3;
    position: absolute;
}

.testimonial-text::before {
    top: -1rem;
    left: 0;
}

.testimonial-text::after {
    bottom: -2rem;
    right: 0;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.author-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent1) 0%, var(--accent2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.author-details h4 {
    color: var(--primary);
    margin-bottom: 0.2rem;
}

.author-details p {
    color: var(--text);
    font-size: 0.9rem;
    opacity: 0.8;
}

/* =============================================
   Footer
   ============================================= */
footer {
    background: var(--dark);
    color: white;
    padding: 3rem 2rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-column h3 {
    color: var(--accent1);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-links a:hover {
    color: var(--accent2);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* =============================================
   Chat Modal
   ============================================= */
#chatModal {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s;
    border: 1px solid rgba(165, 214, 167, 0.5);
}

.chat-header {
    background: var(--gradient-primary);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#resetChat,
#closeChat {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

#resetChat:hover,
#closeChat:hover {
    background: rgba(255, 255, 255, 0.35);
}

#chatMessages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f9f9f9;
}

.message {
    display: flex;
    max-width: 80%;
    animation: messageAppear 0.3s ease-out;
}

@keyframes messageAppear {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.message-content {
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    word-wrap: break-word;
}

.bot-message .message-content {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
    border-top-left-radius: 5px;
}

.user-message .message-content {
    background: var(--gradient-primary);
    color: white;
    border-top-right-radius: 5px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0.8rem 1.2rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    border-top-left-radius: 5px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent1);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.chat-input-container {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    background: white;
}

#userInput {
    flex: 1;
    padding: 0.8rem 1.2rem;
    border: 1px solid #ddd;
    border-radius: 25px;
    margin-right: 0.8rem;
    outline: none;
    transition: border-color 0.3s;
    font-size: 0.95rem;
}

#userInput:focus {
    border-color: var(--accent1);
}

#sendMessage {
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

#sendMessage:hover {
    transform: scale(1.05);
}

#sendMessage:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Chat Button */
#chatButton {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    transition: all 0.3s;
}

#chatButton:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* =============================================
   Page Content
   ============================================= */
.page-content {
    display: none;
}

.active-page {
    display: block;
}

/* =============================================
   Forms
   ============================================= */
.form-container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.form-title {
    text-align: center;
    color: var(--primary);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent1);
    outline: none;
}

.form-submit {
    width: 100%;
    padding: 1rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.form-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(129, 212, 250, 0.4);
}

.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text);
}

.form-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.form-footer a:hover {
    text-decoration: underline;
}

/* =============================================
   Dashboard
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent1) 0%, var(--accent2) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: white;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text);
    font-weight: 500;
}

.dashboard-section {
    background: white;
    border-radius: var(--radius-md);
    padding: 2rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.dashboard-section h2 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

/* =============================================
   Resources Grid
   ============================================= */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.resource-card {
    background: #f9f9f9;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.resource-img {
    height: 160px;
    background: linear-gradient(135deg, var(--accent1) 0%, var(--accent2) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
}

.resource-content {
    padding: 1.5rem;
}

.resource-content h3 {
    color: var(--primary);
    margin-bottom: 0.8rem;
}

.resource-content p {
    color: var(--text);
    margin-bottom: 1.2rem;
}

.resource-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.resource-link:hover {
    text-decoration: underline;
}

/* =============================================
   Notification Toast
   ============================================= */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    z-index: 2000;
    animation: slideIn 0.3s ease-out, fadeOut 0.3s ease-in 2.7s forwards;
    box-shadow: var(--shadow-md);
}

.toast-success {
    background: var(--secondary);
}

.toast-error {
    background: #e53935;
}

.toast-info {
    background: var(--primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* =============================================
   Responsive Design
   ============================================= */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        order: 2;
    }

    nav ul {
        gap: 1.2rem;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero p {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    #chatModal {
        width: 90%;
        right: 5%;
        bottom: 80px;
    }

    .features-grid,
    .testimonial-grid,
    .resources-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .auth-buttons {
        flex-direction: column;
        width: 100%;
    }

    .auth-btn {
        width: 100%;
        text-align: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    #chatModal {
        width: 95%;
        right: 2.5%;
        height: 70vh;
    }

    .section-title {
        font-size: 1.6rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}
