.mental-home-container {
    padding: 0 0 40px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    min-height: calc(100vh - 80px);
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.page-header {
    background: linear-gradient(135deg, #d74848 0%, #90009d 100%);
    color: white;
    padding: 80px 0;
    margin-bottom: 40px;
    position: relative;
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    border-radius: 0 0 100px 100px;
}

/* Animated background patterns */
.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

.page-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.03) 50%, transparent 60%),
        linear-gradient(-45deg, transparent 40%, rgba(255, 255, 255, 0.03) 50%, transparent 60%);
    animation: shimmer 15s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(1deg); }
    66% { transform: translateY(-10px) rotate(-1deg); }
}

@keyframes shimmer {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.page-header .container {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%; /* Ensure container doesn't exceed viewport */
    box-sizing: border-box; /* Include padding in width calculation */
}

.header-content {
    position: relative;
    z-index: 3;
}

.header-content h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
    line-height: 1.1;
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content p {
    font-size: 1.3rem;
    opacity: 0.95;
    line-height: 1.6;
    margin: 0;
    font-weight: 400;
    max-width: 500px;
}

/* Zigzag Image Layout */
.header-images {
    position: relative;
    height: 300px;
    z-index: 2;
    overflow: hidden; /* Prevent images from overflowing */
    width: 100%;
    max-width: 500px; /* Limit maximum width */
    margin: 0 auto;
}

.zigzag-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-image {
    position: absolute;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.header-image:hover {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.header-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.header-image:hover img {
    transform: scale(1.1);
}

/* Zigzag positioning */
.image-1 {
    width: 150px;
    height: 100px;
    top: 20px;
    left: 50px;
    animation: floatY 6s ease-in-out infinite;
}

.image-2 {
    width: 120px;
    height: 120px;
    top: 60px;
    right: 80px;
    border-radius: 50%;
    animation: floatY 8s ease-in-out infinite reverse;
}

.image-3 {
    width: 140px;
    height: 90px;
    bottom: 80px;
    left: 20px;
    animation: floatY 7s ease-in-out infinite;
}

.image-4 {
    width: 110px;
    height: 110px;
    bottom: 40px;
    right: 40px;
    border-radius: 50%;
    animation: floatY 9s ease-in-out infinite reverse;
}

.image-5 {
    width: 160px;
    height: 80px;
    top: 120px;
    left: 180px;
    animation: floatY 5s ease-in-out infinite;
}

@keyframes floatY {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-15px) rotate(1deg); }
}

/* Mental health icons overlay */
.header-image .icon-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.header-image .gradient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgb(56 0 56), rgb(239 26 111 / 84%));
    z-index: 1;
}

/* Decorative elements */
.floating-shapes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.shape {
    position: absolute;
    opacity: 0.1;
    animation: float 20s linear infinite;
}

.shape-1 {
    top: 10%;
    left: 10%;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    animation-delay: -2s;
}

.shape-2 {
    top: 20%;
    right: 15%;
    width: 40px;
    height: 40px;
    background: white;
    transform: rotate(45deg);
    animation-delay: -8s;
}

.shape-3 {
    bottom: 20%;
    left: 20%;
    width: 50px;
    height: 50px;
    background: white;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    animation-delay: -14s;
}

.shape-4 {
    bottom: 30%;
    right: 25%;
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 10px;
    animation-delay: -6s;
}

/* Statistics counter */
.stats-preview {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 20px 40px;
    display: flex;
    gap: 40px;
    z-index: 3;
}

.stat-item {
    text-align: center;
    color: white;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    display: block;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Section Cards */
.section-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.section-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2, #667eea);
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.section-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.section-header {
    margin-bottom: 25px;
}

.section-header h2 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header p {
    color: #666;
    margin: 0;
    font-size: 1rem;
}

/* Prerequisites Section */
.prerequisite {
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 12px;
    border-left: 4px solid #ccc;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.prerequisite.success {
    border-left-color: var(--success-color);
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}

.prerequisite.error {
    border-left-color: #ef5350;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    box-shadow: 0 2px 8px rgba(239, 83, 80, 0.15);
}

.prerequisite i {
    margin-right: 15px;
    font-size: 1.3rem;
    min-width: 20px;
}

.prerequisite.prerequisite.error .prerequisite-action-btn i {
    color:#ffffff
}

.prerequisite.success i {
    color: var(--success-color);
}

.prerequisite.error i {
    color: #ef5350;
}

.prerequisite span {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.prerequisite-action-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(64, 115, 192, 0.3);
    margin-left: 8px;
    white-space: nowrap;
}

.prerequisite-action-btn:hover {
    background: linear-gradient(135deg, #3658a3, #4a5bb8);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(64, 115, 192, 0.4);
    color: white;
    text-decoration: none;
}

.prerequisite.error .prerequisite-action-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.prerequisite.error .prerequisite-action-btn:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

#start-assessment-container {
    text-align: center;
    margin-top: 20px;
}

.btn-large {
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 50px;
    min-width: 200px;
    background-color: #d61c91;
}

.btn-large:hover {
    background-color: #c31182;
}

/* Assessment History */
.assessment-list {
    display: grid;
    gap: 20px;
}

.assessment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.assessment-item:hover {
    background: #f1f5f9;
    transform: translateX(5px);
}

.assessment-info {
    flex: 1;
}

.assessment-date {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 5px;
}

.assessment-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 8px;
}

.status-processing {
    color: #f59e0b;
}

.status-complete {
    color: #10b981;
}

.assessment-scores {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: #64748b;
}

.assessment-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 6px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: #374151;
}

/* Modules Grid */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.module-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.module-card:hover {
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.module-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.5rem;
}

.module-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.module-card p {
    color: #64748b;
    margin-bottom: 15px;
    line-height: 1.5;
}

.module-features {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
}

.module-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #374151;
}

.module-features i {
    color: var(--success-color);
    font-size: 0.8rem;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.action-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    text-align: center;
}

.action-card:hover {
    color: inherit;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
}

.action-card i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.action-card h3 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.1rem;
    font-weight: 600;
}

.action-card p {
    color: #64748b;
    margin: 0;
    font-size: 0.9rem;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: var(--primary-color);
}

.loading-spinner i {
    font-size: 1.2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header {
        padding: 60px 0;
        min-height: 300px;
        border-radius: 0 0 50px 50px; /* Reduced radius for mobile */
    }
    
    .page-header .container {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    
    .header-content h1 {
        font-size: 2.5rem;
    }
    
    .header-content p {
        font-size: 1.1rem;
        max-width: none;
    }
    
    .header-images {
        height: 200px;
        max-width: 100%;
    }
    
    /* Further reduce image sizes for mobile */
    .image-1, .image-3, .image-5 {
        width: 80px;
        height: 55px;
    }
    
    .image-2, .image-4 {
        width: 65px;
        height: 65px;
    }
    
    /* Adjust positioning for mobile */
    .image-1 {
        left: 20px;
        top: 30px;
    }
    
    .image-2 {
        right: 25px;
        top: 70px;
    }
    
    .image-3 {
        left: 5px;
        bottom: 60px;
    }
    
    .image-4 {
        right: 10px;
        bottom: 30px;
    }
    
    .image-5 {
        left: 80px;
        top: 100px;
        width: 100px;
        height: 50px;
    }
    
    .stats-preview {
        position: relative;
        bottom: auto;
        margin-top: 20px;
        padding: 15px 20px; /* Reduced padding */
        gap: 20px; /* Reduced gap */
        flex-wrap: wrap; /* Allow wrapping on very small screens */
        justify-content: center;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .mental-home-container {
        padding: 0;
    }
    
    .section-card {
        padding: 20px;
        margin-bottom: 20px;
        margin-left: 15px;
        margin-right: 15px;
    }
    
    .modules-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 40px 0;
        border-radius: 0 0 30px 30px; /* Further reduced for very small screens */
    }
    
    .page-header .container {
        padding: 0 10px;
    }
    
    .header-content h1 {
        font-size: 2rem;
    }
    
    .header-images {
        height: 150px;
    }
    
    .stats-preview {
        flex-direction: column;
        gap: 15px;
        padding: 15px 20px;
        margin-left: 10px;
        margin-right: 10px;
    }
    
    .section-card {
        padding: 15px;
        margin-left: 10px;
        margin-right: 10px;
    }
    
    .container {
        padding: 0 10px;
    }
}

/* Additional fix for very wide content */
@media (max-width: 320px) {
    .stats-preview {
        gap: 10px;
        padding: 10px 15px;
    }
    
    .stat-item {
        min-width: auto;
    }
    
    .section-card {
        margin-left: 5px;
        margin-right: 5px;
        padding: 10px;
    }
    
    .header-images {
        height: 120px;
    }
    
    /* Hide some decorative elements on very small screens */
    .image-5 {
        display: none;
    }
    
    .floating-shapes {
        display: none;
    }
}

/* Ensure body and html don't cause horizontal scroll */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}
