/* js/style.css */

/* General Body and Main Layout */
main:has(#analysisBreakdownPage:not(.hidden)) {
    padding: 0;
}

/* Hide scrollbar for the main content panel while keeping functionality */
main::-webkit-scrollbar {
    display: none; /* For Chrome, Safari, and Opera */
}
main {
    -ms-overflow-style: none;  /* For Internet Explorer and Edge */
    scrollbar-width: none;  /* For Firefox */
    min-width: 0; /* Prevents flex items from overflowing their container */
}

/* Custom styles for the step progress indicator */
.step {
    position: relative;
}
.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    position: absolute;
    left: -20px; /* Position icon to the left */
    top: 0;
    transition: background-color: 0.3s ease;
    border: 2px solid white; /* Add a border to help with centering */
}
.dark .step-icon {
    border-color: #23262E; /* dark-bg */
}
.step.active .step-icon {
    background-color: #2DD4BF; /* brand-green */
}
.dark .step.active .step-icon {
    background-color: #2DD4BF; /* brand-green */
}
.step.completed .step-icon {
    background-color: #10B981; /* A darker green for completed */
}
.dark .step.completed .step-icon {
     background-color: #10B981; /* A darker green for completed */
}
.step.active .step-spinner {
    display: inline-block;
}

/* Styling for dynamically generated tags and inputs */
.editable-tag {
    background-color: #F3F4F6; /* brand-grey-bg-light */
    color: #374151; /* gray-700 */
    padding: 4px 12px;
    border-radius: 9999px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.dark .editable-tag {
    background-color: #374151; /* brand-grey-bg-dark */
    color: #D1D5DB; /* gray-300 */
}
.editable-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
.editable-tag-remove {
    color: #9CA3AF;
}
.editable-tag-remove:hover {
    color: #EF4444; /* red-500 */
}

/* Styling for the add button */
.add-item-btn {
    background-color: #2DD4BF; /* brand-green */
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}
.dark .add-item-btn {
     background-color: #2DD4BF; /* brand-green */
}
.add-item-btn:hover {
    opacity: 0.9;
}

/* Styling for the input field that appears when adding new items */
.add-input-group {
    display: flex;
    gap: 8px; /* space-x-2 */
    margin-top: 8px;
    width: 100%;
}

.new-item-input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 0.375rem; /* rounded-md */
    font-size: 0.875rem; /* text-sm */
    transition: all 0.2s ease-in-out;
    border: 1px solid; /* Define border style once */
}

/* Light mode styles for the add input */
html:not(.dark) .new-item-input {
    color: #374151; /* gray-700 */
    border-color: #D1D5DB; /* light-input-border */
    background-color: #FFFFFF; /* light-input-bg */
}

/* Dark mode styles for the add input */
.dark .new-item-input {
    color: white;
    border-color: #4A5568; /* dark-input-border */
    background-color: #2D3748; /* dark-input-bg */
}

/* Focus styles for the add input */
.new-item-input:focus {
    outline: none;
    border-color: #2DD4BF; /* brand-green */
    box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.4); /* ring-2 ring-brand-green with opacity */
}

/* Styling for the confirm button in the add group */
.add-confirm-btn {
    padding: 8px 16px;
    background-color: #2DD4BF; /* brand-green */
    color: white;
    font-weight: 500;
    border: none;
    border-radius: 0.375rem; /* rounded-md */
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.add-confirm-btn:hover {
    opacity: 0.9;
}


/* Responsive Tab Container Styling */
.tab-navigation-container {
    display: flex;
    width: 100%;
}
.tab-button {
    flex-grow: 1; /* Make tabs grow to fill space on desktop */
    text-align: center; /* Center content within the tab */
}
.tab-button.active {
    border-bottom: 2px solid #2DD4BF; /* brand-green */
    color: #111827; /* dark text for light mode */
}
.dark .tab-button {
    color: #D1D5DB; /* Set default text color for inactive tabs in dark mode */
}
.dark .tab-button.active {
    border-bottom: 2px solid #2DD4BF; /* brand-green */
    color: white; /* Ensure active tab text is bright white */
}


/* Responsive Sub-Tab Container Styling */
.sub-tab-navigation-container {
    display: flex;
    width: 100%;
}
.sub-tab-button {
    flex-grow: 1; /* Make sub-tabs grow to fill space */
    text-align: center; /* Center their content */
    padding: 0.75rem 0.5rem;
    font-weight: 500;
    color: #6B7280; /* Default text for light mode */
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease-in-out;
}
.dark .sub-tab-button {
    color: #9CA3AF; /* Default text for dark mode */
}
.sub-tab-button:hover {
    background-color: #F9FAFB;
}
.dark .sub-tab-button:hover {
    background-color: #374151;
}

.sub-tab-button.active {
    border-bottom: 2px solid #2DD4BF; /* brand-green */
    background-color: #F0FDF4; /* brand-lime-bg */
    color: #111827;
}
.dark .sub-tab-button.active {
    border-bottom: 2px solid #2DD4BF; /* brand-green */
    color: white;
    background-color: #1f3a37; /* dark green background */
}

/* Mobile-specific adjustments for Tab Navigation */
@media (max-width: 767px) {
    .tab-navigation-container, .sub-tab-navigation-container {
        flex-wrap: wrap; /* Allow tabs to wrap onto the next line */
        justify-content: center; /* Center the wrapped tabs */
    }
    .tab-button, .sub-tab-button {
        flex-grow: 0; /* On mobile, stop tabs from growing unnaturally when wrapped */
    }
    .tab-button {
        padding: 8px 12px; /* Smaller padding */
        font-size: 0.8rem; /* Smaller font size */
    }
}

/* D3 Barometer Styles */
.barometer-needle,
.barometer-pivot {
    fill: #000000;
}

.barometer-score-text {
    font-size: 20px;
    font-weight: bold;
    fill: #000000;
}

.barometer-label-text {
    font-size: 10px;
    fill: #000000;
}

.dark .barometer-needle,
.dark .barometer-pivot,
.dark .barometer-score-text,
.dark .barometer-label-text {
    fill: #FFFFFF;
}


/* Key Metrics Styles */
.metric-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 2px solid #E5E7EB;
    border-radius: 0.75rem;
    padding: 1.5rem 1rem;
}

.dark .metric-item {
    border-color: #4B5563;
}

.metric-value {
    font-size: 2.25rem; /* 3xl */
    line-height: 2.5rem;
    font-weight: 700;
    color: #10B981;
    margin-bottom: 0.75rem;
}

.dark .metric-value {
    color: #2DD4BF;
}

.metric-name {
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: #374151;
}

.dark .metric-name {
    color: #D1D5DB;
}

.metric-context,
.metric-description {
    font-size: 0.875rem;
    color: #6B7280;
    margin-top: 0.75rem;
}

.dark .metric-context,
.dark .metric-description {
    color: #D1D5DB;
}

/* Competitor Benchmarking Carousel */
.carousel-item {
    display: none;
}
.carousel-item.active {
    display: block;
}
.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0,0,0,0.3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s;
}
.carousel-nav-btn:hover {
    background-color: rgba(0,0,0,0.5);
}
.carousel-nav-btn.prev {
    left: 10px;
}
.carousel-nav-btn.next {
    right: 10px;
}


.premium-button {
    background-color: #10B981;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.premium-button:hover {
    background-color: #059669;
}

/* Heatmap Table Styles */
.heatmap-table {
    width: 100%;
    border-collapse: collapse;
}
/* Prevents hidden heatmap from breaking layout of other tabs */
.tab-pane:not(.hidden) .heatmap-table {
    min-width: 600px;
}


.heatmap-table th, .heatmap-table td {
    padding: 0.75rem 1rem;
    text-align: center;
    border: 1px solid #374151;
}

html:not(.dark) .heatmap-table th, html:not(.dark) .heatmap-table td {
    border-color: #A3E635;
}

.heatmap-table th {
    background-color: #374151;
    color: #F9FAFB;
    font-weight: 600;
}
html:not(.dark) .heatmap-table th {
    background-color: #F9FAFB;
    color: #1F2937;
}


.heatmap-table td {
    font-weight: 500;
    font-size: 0.875rem;
    color: white; /* Default text color for dark mode and data cells */
}


.heatmap-table th:first-child {
    text-align: left;
    background-color: #1F2937;
}
html:not(.dark) .heatmap-table th:first-child {
    background-color: #F3F4F6;
}


.heatmap-table tr>*:first-child {
    text-align: left;
    font-weight: bold;
    color: #F9FAFB;
}
html:not(.dark) .heatmap-table tr>*:first-child {
    color: #111827;
}


/* Heatmap Color Classes (only sets background) */
.heatmap-score-very-high { background-color: #10B981; }
.heatmap-score-high { background-color: #2DD4BF; }
.heatmap-score-medium-high { background-color: #A3E635; }
.heatmap-score-medium { background-color: #FBBF24; }
.heatmap-score-medium-low { background-color: #F97316; }
.heatmap-score-low { background-color: #F87171; }

/* Styles for Competitive Analysis Tab */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2.5rem;
    padding: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.chart-wrapper {
    background-color: #F0FDF4; /* Light mode default */
    color: #1F2937;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    min-height: 450px; /* Changed from 400px */
    display: flex;
    flex-direction: column;
}

.dark .chart-wrapper {
    background-color: #1f2937;
    color: white;
}

.chart-wrapper canvas {
    flex-grow: 1;
    min-height: 300px;
    max-width: 100%;
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #111827;
}

.dark .chart-title {
    color: #F9FAFB;
}

.legend-item-text {
    font-size: 0.875rem;
    color: #374151;
    word-break: break-all;
}
.dark .legend-item-text {
    color: #D1D5DB;
}

/* NEW: Styles for Sentiment Analysis Tab */
#sentimentAnalysisTab .sub-tab-pane > div {
    /* Styles for the light/dark containers of each chart */
    background-color: #F9FAFB;
}
.dark #sentimentAnalysisTab .sub-tab-pane > div {
    background-color: #1f2937;
}

#sentimentAnalysisTab h3 {
    color: #111827;
}
.dark #sentimentAnalysisTab h3 {
    color: #F9FAFB;
}

/* NEW: Styles for Premium Gating */
/* --- START MODIFICATION --- */
.content-blurred {
    filter: blur(8px);
    -webkit-filter: blur(8px); /* For Safari */
    pointer-events: none; /* Prevents interaction with blurred content */
    user-select: none;
    opacity: 0.5;
}
/* --- END MODIFICATION --- */

.premium-cta-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-start; /* Changed from 'center' */
    justify-content: center;
    padding: 2rem;
    padding-top: 10rem; /* New: Pushes the CTA down by a fixed amount */
    z-index: 10;
}

/* Make sure the parent tab pane can contain the absolutely positioned overlay */
.tab-pane {
    position: relative;
    min-height: 500px; /* Give tab panes a minimum height */
}

/* Fix for invisible password field text on the reset page */
input#newPassword[type="password"] {
    -webkit-text-security: disc; /* Use dots for password characters */
    -moz-text-security: disc;    /* Fallback for Firefox */
    text-security: disc;         /* Standard property */
}

#registerPassword, #signInPassword, #newPassword {
    color: #1f2937; /* Sets a dark text color for light mode */
}

.dark #registerPassword,
.dark #signInPassword,
.dark #newPassword {
    color: #ffffff; /* Explicitly sets text color to white for dark mode */
}

/* START OF CHANGES: Pricing Page Styles */
.pricing-toggle-bg {
    background-color: #E5E7EB; /* gray-200 */
}
.dark .pricing-toggle-bg {
    background-color: #374151; /* gray-700 */
}
.pricing-toggle-btn {
    transition: color 0.3s ease;
    z-index: 10; /* Ensure text is on top of the slider */
}
.pricing-toggle-btn.active {
    color: #111827; /* gray-900 */
}
.dark .pricing-toggle-btn.active {
    color: #FFFFFF;
}
.pricing-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    height: calc(100% - 4px);
    width: calc(50% - 2px);
    background-color: #FFFFFF;
    border-radius: 9999px;
    transition: transform 0.3s ease-in-out;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.dark .pricing-toggle-slider {
    background-color: #4B5563; /* gray-600 */
}
#pricing-toggle:checked ~ .pricing-toggle-slider {
    transform: translateX(100%);
}
.plan-card.popular {
    border-color: #8B5CF6; /* A purple color for popular */
    transform: scale(1.05);
    z-index: 10;
}
.dark .plan-card.popular {
    border-color: #A78BFA;
    background-color: #3730A3; /* A darker purple */
}
.plan-card {
    transition: all 0.2s ease-in-out;
}
@media (max-width: 1023px) {
    .plan-card.popular {
        transform: scale(1);
    }
}
.plan-feature-list li {
    display: flex;
    align-items: flex-start;
}
.plan-feature-list i {
    color: #2DD4BF; /* brand-green */
    margin-right: 0.75rem;
    margin-top: 4px;
    flex-shrink: 0;
}

/* --- START: Recent Projects Link Styling --- */
#recentProjectsList a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

/* Light mode hover effect */
#recentProjectsList a:hover {
    background-color: #E5E7EB; /* gray-200 */
    color: #111827; /* gray-900 */
}

/* Dark mode hover effect */
.dark #recentProjectsList a:hover {
    background-color: #374151; /* gray-700 */
    color: #FFFFFF; /* white */
}
/* --- END: Recent Projects Link Styling --- */

/* --- START: News/Blog Page Styling --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2rem;
}
@media (min-width: 768px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
.blog-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    background-color: #FFFFFF;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.dark .blog-card {
    background-color: #2D3748; /* dark-input-bg */
    border: 1px solid #4A5568; /* dark-input-border */
}
.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
@media (min-width: 1024px) {
    .blog-card {
        grid-template-columns: 1fr 1fr;
        gap: 0;
    }
}
.blog-image-link {
    display: block;
}
.blog-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
}
@media (min-width: 1024px) {
    .blog-image {
        height: 100%;
    }
}
.blog-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}
.blog-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.blog-category {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}
.blog-date {
    font-size: 0.875rem;
    color: #6B7280; /* gray-500 */
}
.dark .blog-date {
    color: #9CA3AF; /* gray-400 */
}
.blog-title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: #111827; /* gray-900 */
    margin-bottom: 0.5rem;
}
.dark .blog-title {
    color: #FFFFFF;
}
.blog-author {
    font-size: 0.875rem;
    color: #6B7280; /* gray-500 */
    margin-bottom: 1.5rem;
    flex-grow: 1;
}
.dark .blog-author {
    color: #9CA3AF; /* gray-400 */
}
.blog-read-more {
    font-weight: 600;
    color: #111827; /* gray-900 */
    transition: color 0.2s;
}
.dark .blog-read-more {
    color: #FFFFFF;
}
.blog-read-more:hover {
    color: #2DD4BF; /* brand-green */
}
/* --- END: News/Blog Page Styling --- */
