/* Dashboard Features Section - Clean Rebuild */

.dashboard-features-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
    opacity: 0;
    display: block;
    overflow: hidden;
    background-color: var(--bg-color);
}

/* Grid background */
.dashboard-features-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image: 
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
}

/* Section Header - Fixed positioning */
.features-header {
    position: fixed;
    top: 120px;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 0 2rem 1rem;
    background: transparent;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Show features heading when on section */
body.on-dashboard .features-header {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 95;
}

/* Hide features heading when not on the section */
body:not(.on-dashboard) .features-header {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.features-heading {
    font-size: clamp(1.875rem, 4vw, 3rem);
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.dashboard-text {
    color: var(--text-primary);
    font-weight: 500;
}

/* Main wrapper */
.features-container {
    position: relative;
    width: 100%;
    height: 100vh;
    padding: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Features Grid Container */
.features-grid-container {
    width: 100%;
    max-width: 1400px; /* Wider than navbar */
    margin: 0 auto;
    padding: 0 40px;
    padding-top: 180px; /* Account for fixed header */
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
}

/* Features Row */
.features-row {
    display: flex;
    gap: 0;
    position: relative;
}

/* Top row */
.features-row.top-row {
    flex: 0 0 calc((100vh - 300px) / 2); /* Half of available viewport height */
    min-height: 250px;
    border-bottom: 3px solid transparent;
    background-image: linear-gradient(90deg, 
        transparent 0%, 
        rgba(0, 122, 255, 0.4) 10%,
        rgba(16, 185, 129, 0.4) 50%,
        rgba(20, 184, 166, 0.4) 90%,
        transparent 100%);
    background-position: bottom;
    background-size: 100% 3px;
    background-repeat: no-repeat;
}

/* Bottom row */
.features-row.bottom-row {
    flex: 0 0 calc((100vh - 300px) / 2); /* Half of available viewport height */
    min-height: 250px;
}

/* Feature sections */
.feature-section {
    position: relative;
    padding: 4rem; /* Even more padding */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* Hover effects */
.feature-section:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
}

/* Dark mode styles */
body[data-theme="dark"] .feature-section {
    background: rgba(255, 255, 255, 0.01);
}

body[data-theme="dark"] .feature-section:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Size ratios */
.feature-section.large-left {
    flex: 0 0 70%;
}

.feature-section.small-right {
    flex: 0 0 30%;
}

.feature-section.small-left {
    flex: 0 0 30%;
}

.feature-section.large-right {
    flex: 0 0 70%;
}

/* Vertical dividers */
.feature-section.large-left::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(0, 122, 255, 0.4) 20%,
        rgba(16, 185, 129, 0.4) 50%,
        rgba(20, 184, 166, 0.4) 80%,
        transparent 100%);
}

.feature-section.small-left::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(0, 122, 255, 0.4) 20%,
        rgba(16, 185, 129, 0.4) 50%,
        rgba(20, 184, 166, 0.4) 80%,
        transparent 100%);
}

/* Feature content */
.feature-content {
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.feature-content h3 {
    font-size: 2.25rem; /* Much larger font */
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.feature-content p {
    font-size: 1.25rem; /* Larger font */
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 1200px) {
    .features-grid-container {
        min-height: 600px;
    }
    
    .features-row.top-row,
    .features-row.bottom-row {
        flex: 0 0 250px; /* Maintain decent height on medium screens */
    }
    
    .feature-content h3 {
        font-size: 1.5rem;
    }
    
    .feature-content p {
        font-size: 1rem;
    }
}

@media (max-width: 1024px) {
    /* Fix section background */
    .dashboard-features-section {
        background-color: transparent !important;
        background: none !important;
    }
    
    /* Hide grid background on mobile */
    .dashboard-features-section::before {
        display: none !important;
    }
    
    /* Adjust header positioning */
    .features-header {
        top: 100px;
        padding: 0 1rem 0.5rem;
    }
    
    .features-heading {
        font-size: 1.75rem;
    }
    
    /* Container adjustments */
    .features-container {
        position: fixed;
        top: 160px;
        bottom: 20px;
        left: 0;
        right: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        padding: 0;
    }
    
    .features-grid-container {
        padding: 1rem;
        padding-top: 0;
        height: 100%;
        max-width: 400px;
        display: grid;
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(0, 1fr);
        gap: 0.5rem;
        align-content: center;
        margin: 0 auto;
    }
    
    /* Remove row structure on mobile */
    .features-row {
        display: contents; /* This makes children act as direct grid items */
    }
    
    .features-row.top-row {
        background: none;
        border: none;
    }
    
    /* Feature cards */
    .feature-section {
        padding: 1.25rem;
        background: linear-gradient(135deg, 
            rgba(0, 122, 255, 0.05) 0%, 
            rgba(16, 185, 129, 0.03) 100%);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 16px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 
            0 2px 8px rgba(0, 0, 0, 0.05),
            0 0 0 1px rgba(255, 255, 255, 0.02) inset;
        transform: none !important;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: auto;
        height: auto;
        flex: none;
    }
    
    .feature-section:hover {
        transform: none !important;
        background: linear-gradient(135deg, 
            rgba(0, 122, 255, 0.08) 0%, 
            rgba(16, 185, 129, 0.05) 100%);
    }
    
    /* All sections same width on mobile */
    .feature-section.large-left,
    .feature-section.small-right,
    .feature-section.small-left,
    .feature-section.large-right {
        flex: none;
        width: 100%;
    }
    
    /* Hide all dividers on mobile */
    .feature-section::after {
        display: none !important;
    }
    
    /* Simplify content */
    .feature-content {
        text-align: center;
        max-width: 100%;
    }
    
    .feature-content h3 {
        font-size: 1.125rem;
        font-weight: 600;
        margin-bottom: 0.75rem;
        color: var(--text-primary);
    }
    
    .feature-content p {
        font-size: 0.875rem;
        line-height: 1.5;
        color: var(--text-secondary);
        opacity: 0.9;
    }
    
    /* Remove the icon boxes */
    .feature-content h3::before {
        display: none !important;
    }
    
    /* Make feature sections clickable on mobile */
    .feature-section {
        cursor: pointer;
    }
}

/* Medium mobile devices (576px - 768px) */
@media (min-width: 576px) and (max-width: 768px) {
    .features-grid-container {
        max-width: 500px;
        gap: 0.75rem;
    }
    
    .feature-section {
        padding: 1.5rem;
        min-height: 120px;
    }
    
    .feature-content h3 {
        font-size: 1.25rem;
    }
    
    .feature-content p {
        font-size: 0.9375rem;
    }
}

/* Small mobile devices (414px - 575px) */
@media (min-width: 414px) and (max-width: 575px) {
    .features-grid-container {
        max-width: 380px;
    }
    
    .feature-section {
        padding: 1.375rem;
    }
}

/* iPhone 12/13/14 Pro (390px) */
@media (min-width: 390px) and (max-width: 413px) {
    .features-grid-container {
        max-width: 360px;
    }
}

/* Standard mobile (375px - 389px) */
@media (min-width: 375px) and (max-width: 389px) {
    .features-grid-container {
        max-width: 340px;
    }
    
    .feature-section {
        padding: 1.125rem;
        min-height: 100px;
    }
    
    .feature-content h3 {
        font-size: 1rem;
    }
    
    .feature-content p {
        font-size: 0.8125rem;
    }
}

/* Small mobile (360px - 374px) */
@media (min-width: 360px) and (max-width: 374px) {
    .features-grid-container {
        max-width: 320px;
    }
    
    .features-heading {
        font-size: 1.625rem;
    }
}

/* Very small devices (below 360px) */
@media (max-width: 359px) {
    .features-header {
        top: 90px;
        padding: 0 0.75rem 0.5rem;
    }
    
    .features-heading {
        font-size: 1.5rem;
    }
    
    .features-grid-container {
        max-width: 280px;
        gap: 0.375rem;
        padding: 0.75rem;
    }
    
    .feature-section {
        padding: 1rem;
        min-height: 90px;
    }
    
    .feature-content h3 {
        font-size: 0.9375rem;
    }
    
    .feature-content p {
        font-size: 0.75rem;
        line-height: 1.4;
    }
}

/* Feature Modal Styles - Glassmorphic Design */
.feature-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

/* Dark mode overlay adjustment */
body[data-theme="dark"] .feature-modal-overlay {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.feature-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.feature-modal {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 380px;
    width: 100%;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset,
        0 0 120px rgba(255, 255, 255, 0.4) inset;
    position: relative;
    transform: translateZ(20px);
    transition: all 0.3s ease;
    animation: modalSlideUp 0.4s ease;
}

/* Dark mode specific modal content */
body[data-theme="dark"] .feature-modal {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px) saturate(200%);
    -webkit-backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 0 120px rgba(255, 255, 255, 0.1) inset;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Add subtle 3D effect on hover */
.feature-modal:hover {
    transform: translateZ(30px) rotateX(-1deg) rotateY(1deg);
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.4) inset,
        0 0 140px rgba(255, 255, 255, 0.5) inset;
}

body[data-theme="dark"] .feature-modal:hover {
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset,
        0 0 140px rgba(255, 255, 255, 0.15) inset;
}

/* Glass shine effect */
.feature-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.4) 0%, 
        rgba(255, 255, 255, 0.1) 40%,
        transparent 100%);
    border-radius: 24px 24px 0 0;
    pointer-events: none;
    opacity: 0.7;
}

/* Dark mode gradient overlay adjustment */
body[data-theme="dark"] .feature-modal::before {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.2) 0%, 
        rgba(255, 255, 255, 0.05) 40%,
        transparent 100%);
    opacity: 0.5;
}

.feature-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    position: relative;
    z-index: 2;
}

.feature-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    text-shadow: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.feature-modal-content {
    color: #4a4a4a;
    line-height: 1.6;
    font-size: 0.95rem;
    text-align: center;
    position: relative;
    z-index: 2;
    text-shadow: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Dark mode text colors */
body[data-theme="dark"] .feature-modal-title {
    color: white;
    text-shadow: none;
}

body[data-theme="dark"] .feature-modal-content {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: none;
}

.feature-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.feature-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
    border-color: rgba(0, 0, 0, 0.2);
}

.feature-modal-close svg {
    width: 16px;
    height: 16px;
    stroke: #4a4a4a;
    opacity: 0.8;
}

/* Dark mode close button */
body[data-theme="dark"] .feature-modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body[data-theme="dark"] .feature-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

body[data-theme="dark"] .feature-modal-close svg {
    stroke: white;
}

/* Debug: Force modal visibility */
@media (max-width: 1024px) {
    .feature-modal-overlay {
        z-index: 99999 !important;
    }
    
    .feature-modal-overlay.active {
        display: flex !important;
        opacity: 1 !important;
    }
    
    .feature-modal {
        z-index: 100000 !important;
        position: relative !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}