/* Analytics Page Styles */

.analytics-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.analytics-page .page-header {
    text-align: center;
    margin-bottom: 30px;
}

.analytics-page .page-header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.analytics-page .page-header p {
    color: #6c757d;
    font-size: 1.1em;
    margin: 0;
    line-height: 1.5;
}

/* Analytics Content Area */
.analytics-content {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    margin-top: 20px;
    min-height: 400px;
    padding: 20px;
}

.analytics-content.has-data {
    display: block;
}

.analytics-content.no-data {
    display: flex;
    align-items: center;
    justify-content: center;
}

.analytics-placeholder {
    text-align: center;
    padding: 60px 40px;
    color: #6c757d;
    width: 100%;
}

.analytics-placeholder .placeholder-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.7;
}

.analytics-placeholder h3 {
    color: #495057;
    margin-bottom: 15px;
    font-weight: 600;
}

.analytics-placeholder p {
    font-size: 1.1em;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* Enhanced Empty State Styles */
.analytics-placeholder .getting-started-hero {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.analytics-placeholder .page-intro {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 40px;
    text-align: left;
}

.analytics-placeholder .intro-icon {
    font-size: 3em;
    flex-shrink: 0;
    opacity: 0.8;
}

.analytics-placeholder .intro-text {
    flex: 1;
}

.analytics-placeholder .intro-text h3 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1.8em;
    font-weight: 600;
}

.analytics-placeholder .intro-text p {
    color: #6c757d;
    font-size: 1.1em;
    line-height: 1.6;
    margin: 0;
    max-width: none;
}

/* Step-by-Step Guide */
.empty-state-steps {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid #dee2e6;
}

.empty-state-steps h4 {
    color: #2c3e50;
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

.steps-list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex: 1;
    min-width: 180px;
    max-width: 220px;
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1em;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
    text-align: left;
}

.step-content strong {
    display: block;
    color: #2c3e50;
    font-size: 1.1em;
    margin-bottom: 5px;
    font-weight: 600;
}

.step-content p {
    color: #6c757d;
    font-size: 0.9em;
    margin: 0;
    line-height: 1.4;
}

.step-arrow {
    font-size: 1.5em;
    color: #6c757d;
    font-weight: 300;
    flex-shrink: 0;
}

/* Action Buttons */
.empty-state-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.empty-state-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.empty-state-actions .btn svg {
    flex-shrink: 0;
}

/* Chart Preview */
.chart-preview {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 30px;
    border: 1px solid #dee2e6;
}

.preview-label {
    color: #495057;
    font-weight: 600;
    margin-bottom: 20px;
    font-size: 1.1em;
}

.preview-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.preview-chart {
    background: white;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #dee2e6;
}

.preview-chart .preview-title {
    color: #495057;
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 15px;
    text-align: center;
}

.preview-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 10px;
    height: 120px;
    padding: 10px 0;
}

.preview-bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    min-height: 20px;
    transition: transform 0.2s ease;
}

.preview-bar:hover {
    transform: scaleY(1.1);
}

.preview-donut {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    position: relative;
    border-radius: 50%;
    background: conic-gradient(
        #667eea 0deg 144deg,
        #764ba2 144deg 252deg,
        #f093fb 252deg 360deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-donut::before {
    content: '';
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    position: absolute;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .analytics-page {
        padding: 15px;
    }
    
    .analytics-placeholder {
        padding: 40px 20px;
    }
    
    .analytics-placeholder .placeholder-icon {
        font-size: 3em;
    }
    
    .analytics-placeholder h3 {
        font-size: 1.3em;
    }
    
    .analytics-placeholder p {
        font-size: 1em;
    }
    
    /* Enhanced empty state responsive */
    .analytics-placeholder .getting-started-hero {
        padding: 15px;
    }
    
    .analytics-placeholder .page-intro {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .analytics-placeholder .intro-text {
        text-align: center;
    }
    
    .analytics-placeholder .intro-text h3 {
        font-size: 1.5em;
    }
    
    .empty-state-steps {
        padding: 20px;
    }
    
    .steps-list {
        flex-direction: column;
        gap: 15px;
    }
    
    .step-arrow {
        transform: rotate(90deg);
        margin: 5px 0;
    }
    
    .step-item {
        max-width: 100%;
        width: 100%;
    }
    
    .empty-state-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .empty-state-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .preview-charts {
        grid-template-columns: 1fr;
    }
}

/* Progress bar container specific to analytics */
#analyticsProgressContainer {
    margin: 20px 0;
}

/* Chart Container Styles */
.chart-wrapper {
    width: 100%;
    margin-bottom: 30px;
}

.chart-title {
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

/* Chart Title Container with Toggle */
.chart-title-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

.chart-title-container .chart-title {
    margin: 0;
    text-align: center;
    flex: 1;
}

/* Chart Type Segmented Control Styles */
.chart-type-segmented {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0;
    background: #e9ecef;
    border-radius: 8px;
    padding: 4px;
}

.chart-type-segmented .segmented-control-button {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
}

.chart-type-segmented .segmented-control-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #2c3e50;
}

.chart-type-segmented .segmented-control-button.active {
    background: #007bff;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.chart-type-segmented .segmented-control-button.active:hover {
    background: #0056b3;
    color: #fff;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 450px;
    margin-bottom: 20px;
}

.chart-container canvas {
    max-height: 400px !important;
    width: 100% !important;
}

/* Charts Grid Layout */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 20px;
}

/* All charts now span full width in single column layout */
.charts-grid .chart-container {
    width: 100%;
}

/* Donut Chart Specific Styles */
.donut-chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.donut-chart-container canvas {
    max-height: 380px !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Chart loading state */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #6c757d;
    font-size: 1.1em;
}

.chart-loading::before {
    content: "📊";
    font-size: 2em;
    margin-right: 10px;
    opacity: 0.7;
}

/* Chart responsive adjustments */
@media (max-width: 768px) {
    .charts-grid {
        gap: 20px;
    }
    
    .chart-container {
        height: 350px;
    }
    
    .chart-container canvas {
        max-height: 300px !important;
    }
    
    .donut-chart-container {
        height: 350px;
    }
    
    .donut-chart-container canvas {
        max-height: 320px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .chart-title {
        font-size: 1.3em;
    }
    
    /* Responsive chart title container */
    .chart-title-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        position: static;
    }
    
    .chart-title-container .chart-title {
        text-align: center;
        width: 100%;
    }
    
    .chart-type-segmented {
        position: static;
        align-self: center;
    }
}

@media (max-width: 480px) {
    .chart-container {
        height: 300px;
    }
    
    .chart-container canvas {
        max-height: 250px !important;
    }
    
    .donut-chart-container {
        height: 300px;
    }
    
    .donut-chart-container canvas {
        max-height: 270px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .chart-title {
        font-size: 1.2em;
    }
    
    /* Mobile adjustments for segmented control */
    .chart-type-segmented .segmented-control-button {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Ensure consistency with stored-transactions page layout */
.analytics-page .actions-bar {
    /* Inherit all styles from stored-transactions.css */
    display: inherit;
}

/* Tab Navigation Styles */
.analytics-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 30px;
    background: #fff;
}

.analytics-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    outline: none;
    position: relative;
    bottom: -2px;
}

.analytics-tab:hover {
    color: #2c3e50;
    background: #f8f9fa;
}

.analytics-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background: transparent;
}

.analytics-tab.active:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

/* Tab Content Styles */
.analytics-tab-content {
    display: none;
}

.analytics-tab-content.active {
    display: block;
}

/* Chart View Segmented Control */
.charts-view-control {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.charts-view-segmented {
    display: flex;
    align-items: center;
    gap: 0;
    background: #e9ecef;
    border-radius: 8px;
    padding: 4px;
}

.charts-view-button {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #495057;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
}

.charts-view-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #2c3e50;
}

.charts-view-button.active {
    background: #007bff;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.charts-view-button.active:hover {
    background: #0056b3;
    color: #fff;
}

/* Comparative Analytics Styles */
.comparative-analytics-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Comparison Type Segmented Control */
.comparative-type-control {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.comparative-type-segmented {
    display: flex;
    align-items: center;
    gap: 0;
    background: #e9ecef;
    border-radius: 8px;
    padding: 4px;
}

.comparative-type-button {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #495057;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    outline: none;
}

.comparative-type-button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #2c3e50;
}

.comparative-type-button.active {
    background: #007bff;
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.comparative-type-button.active:hover {
    background: #0056b3;
    color: #fff;
}

.comparative-section {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    border: 1px solid #e9ecef;
}

.comparative-section-title {
    color: #2c3e50;
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
}

.comparative-placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 1.1em;
}

.comparative-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.comparative-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.comparative-period {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.period-label {
    color: #6c757d;
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.period-range {
    color: #495057;
    font-size: 0.85em;
    margin-bottom: 12px;
}

.period-amount {
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 600;
}

.comparative-change {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 2px solid transparent;
}

.comparative-change.increase {
    background: #f8d7da;
    border-color: #dc3545;
}

.comparative-change.decrease {
    background: #d4edda;
    border-color: #28a745;
}

.change-label {
    color: #6c757d;
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.change-amount {
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 600;
    margin-bottom: 4px;
}

.comparative-change.increase .change-amount {
    color: #721c24;
}

.comparative-change.decrease .change-amount {
    color: #155724;
}

.change-percent {
    font-size: 1.1em;
    font-weight: 600;
}

.comparative-change.increase .change-percent {
    color: #721c24;
}

.comparative-change.decrease .change-percent {
    color: #155724;
}

/* Group and Category Comparison Styles */
.comparative-groups,
.comparative-categories {
    margin-top: 20px;
}

.comparative-subsection-title {
    color: #2c3e50;
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.comparative-categories-header {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 20px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-header-amounts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    text-align: right;
}

.category-header-amount {
    text-align: right;
}

.category-header-change {
    text-align: right;
}

.comparative-category-item {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 20px;
    padding: 16px;
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

.comparative-category-item:hover {
    background: #f8f9fa;
}

.comparative-category-item:last-child {
    border-bottom: none;
}

.category-name {
    color: #2c3e50;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.category-amounts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    text-align: right;
}

.category-amount {
    color: #495057;
    font-weight: 500;
}

.category-amount.current {
    color: #2c3e50;
    font-weight: 600;
}

.category-amount.clickable-amount {
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: underline;
    text-decoration-color: transparent;
}

.category-amount.clickable-amount:hover {
    color: #007bff;
    text-decoration-color: #007bff;
    transform: translateY(-1px);
}

.category-change {
    font-weight: 500;
}

.category-change.increase {
    color: #dc3545;
}

.category-change.decrease {
    color: #28a745;
}

/* Responsive adjustments for comparative analytics */
@media (max-width: 768px) {
    .analytics-tab {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .comparative-type-button,
    .charts-view-button {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .comparative-summary {
        grid-template-columns: 1fr;
    }
    
    .comparative-categories-header,
    .comparative-category-item {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .category-header-amounts,
    .category-amounts {
        grid-template-columns: 1fr;
        text-align: left;
    }
    
    .category-header-amount,
    .category-amount {
        text-align: left;
    }
    
    .category-header-change,
    .category-change {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .comparative-type-button,
    .charts-view-button {
        padding: 8px 12px;
        font-size: 13px;
    }
}
