/**
 * MonoEdge Analytics Styles
 *
 * @package Monoedge\BookingOrdering
 * @since 1.0.0
 */

/* ===== Analytics Page Container ===== */
.mbo-analytics-page {
    padding: 20px;
    max-width: 1400px;
}

.mbo-analytics-page h1 {
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
    color: #1e293b;
}

.mbo-analytics-page h2 {
    font-size: 20px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 20px;
}

.mbo-analytics-page h3 {
    font-size: 18px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 15px;
}

/* ===== Filters ===== */
.mbo-analytics-filters {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.mbo-filters-form {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.mbo-analytics-filters select,
.mbo-analytics-filters input[type="month"],
.mbo-analytics-filters input[type="date"],
.mbo-analytics-filters input[type="text"]#mbo-year-month-filter,
.mbo-analytics-filters input[type="text"]#mbo-custom-start-date,
.mbo-analytics-filters input[type="text"]#mbo-custom-end-date {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    min-width: 180px;
    height: 36px;
    box-sizing: border-box;
    line-height: 1.5;
    vertical-align: middle;
}

/* Datepicker text inputs */
.mbo-analytics-filters input[type="text"]#mbo-year-month-filter,
.mbo-analytics-filters input[type="text"]#mbo-custom-start-date,
.mbo-analytics-filters input[type="text"]#mbo-custom-end-date {
    cursor: pointer;
    background-color: #fff;
}

.mbo-filter-label {
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    padding: 0 5px;
    white-space: nowrap;
}

.mbo-custom-date-range {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px;
    background: #f8fafc;
    border-radius: 6px;
    width: 100%;
}

/* ===== Tabs ===== */
.mbo-analytics-tabs {
    background: #fff;
    padding: 0;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 0;
    overflow-x: auto;
    margin-bottom: 0;
}

.mbo-tab-button {
    flex: 1;
    min-width: 120px;
    padding: 15px 20px;
    background: #f8fafc;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mbo-tab-button:hover {
    background: #f1f5f9;
    color: #334155;
}

.mbo-tab-button.active {
    background: #fff;
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.mbo-tab-button .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ===== Tab Content ===== */
.mbo-tab-content {
    background: #fff;
    padding: 30px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    min-height: 400px;
}

.mbo-tab-content.active {
    display: block;
}

/* ===== Loader ===== */
.mbo-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 20px;
}

.mbo-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: mbo-spin 0.8s linear infinite;
}

.mbo-loader p {
    font-size: 14px;
    color: #64748b;
    margin: 0;
    font-weight: 500;
}

/* ===== Data Container ===== */
.mbo-data-container {
    /* min-height: 300px; */
}

.mbo-data-preview {
    background: #f8fafc;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.mbo-data-preview h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #334155;
}

.mbo-data-preview pre {
    background: #fff;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    overflow-x: auto;
    font-size: 12px;
    line-height: 1.6;
    margin: 0;
    max-height: 500px;
    overflow-y: auto;
}

/* ===== Performance Overview ===== */
.mbo-performance-overview {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mbo-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.mbo-stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mbo-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mbo-stat-icon {
    font-size: 32px;
    line-height: 1;
}

.mbo-stat-content {
    flex: 1;
}

.mbo-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.mbo-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.mbo-stat-change {
    font-size: 13px;
    font-weight: 600;
    margin-top: 4px;
}

.mbo-stat-change.positive {
    color: #10b981;
}

.mbo-stat-change.negative {
    color: #ef4444;
}

/* ===== Trend Graph ===== */
.mbo-trend-graph {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mbo-trend-graph canvas {
    max-height: 400px;
}

/* ===== Analytics Grid ===== */
.mbo-analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.mbo-analytics-card {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===== Channels List ===== */
.mbo-channels-list {
    margin-top: 15px;
}

.mbo-channel-item {
    padding: 15px;
    margin-bottom: 12px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
}

.mbo-channel-item:last-child {
    margin-bottom: 0;
}

.mbo-channel-name {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
}

.mbo-channel-stats {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: #64748b;
    margin-bottom: 8px;
}

.mbo-channel-conversion {
    font-size: 12px;
    color: #10b981;
    font-weight: 600;
    margin-bottom: 8px;
}

.mbo-progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.mbo-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width 0.3s ease;
}

/* ===== Devices Chart ===== */
.mbo-devices-chart {
    margin-top: 20px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Pages Table ===== */
.mbo-pages-table,
.mbo-qr-codes-table {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mbo-pages-table table,
.mbo-qr-codes-table table {
    margin-top: 15px;
}

.mbo-pages-table th,
.mbo-qr-codes-table th {
    font-weight: 600;
    text-align: left;
}

.mbo-pages-table td small {
    color: #64748b;
}

/* ===== Heatmap ===== */
.mbo-heatmap {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mbo-heatmap-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 4px;
    margin-top: 20px;
}

.mbo-heatmap-table th {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-align: center;
    padding: 8px;
}

.mbo-heatmap-table td {
    text-align: center;
    padding: 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
    position: relative;
}

.mbo-heatmap-table td:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.mbo-heatmap-value {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
}

.mbo-heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
    font-size: 12px;
    color: #64748b;
}

.mbo-legend-box {
    width: 30px;
    height: 15px;
    border-radius: 2px;
    border: 1px solid #e2e8f0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .mbo-stats-grid {
        grid-template-columns: 1fr;
    }

    .mbo-analytics-grid {
        grid-template-columns: 1fr;
    }

    .mbo-filters-form {
        flex-direction: column;
        align-items: stretch;
    }

    .mbo-analytics-filters select {
        width: 100%;
    }

    .mbo-tab-button {
        min-width: 100px;
        padding: 12px 15px;
        font-size: 12px;
    }

    .mbo-tab-button .dashicons {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }

    .mbo-tab-content {
        padding: 20px;
    }

    .mbo-heatmap-table {
        font-size: 11px;
    }

    .mbo-heatmap-table td {
        padding: 10px;
    }

    .mbo-heatmap-value {
        font-size: 10px;
    }
}

/* ===== Loading State ===== */
.mbo-analytics-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
}

.mbo-analytics-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: mbo-spin 1s linear infinite;
}

@keyframes mbo-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Summary Cards ===== */
.mbo-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mbo-stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 24px;
    background: #f8fafc;
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mbo-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mbo-stat-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 28px;
}

.mbo-stat-icon.mbo-stat-bookings {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    color: #fff;
}

.mbo-stat-icon.mbo-stat-orders {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: #fff;
}

.mbo-stat-icon.mbo-stat-sales {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: #fff;
}

.mbo-stat-content {
    flex: 1;
}

.mbo-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.2;
}

.mbo-stat-label {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    margin: 4px 0;
}

.mbo-stat-change {
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
    margin-top: 4px;
}

/* ===== Change Indicators ===== */
.mbo-change-positive {
    color: #10b981;
}

.mbo-change-negative {
    color: #ef4444;
}

/* ===== Daily Trends Chart ===== */
.mbo-chart-section {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mbo-chart-container {
    position: relative;
    height: 400px;
    margin-top: 20px;
}

.mbo-chart-container canvas {
    max-height: 400px;
}

/* ===== Funnel Analysis ===== */
.mbo-funnel-section {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mbo-funnel-container {
    background: #f8fafc;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.mbo-funnel-container:last-child {
    margin-bottom: 0;
}

.mbo-funnel-container h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: #1e293b;
}

.mbo-funnel-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.mbo-funnel-step {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mbo-funnel-bar {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    border-radius: 8px;
    padding: 16px 20px;
    color: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
    box-sizing: border-box;
}

.mbo-funnel-bar:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.mbo-funnel-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mbo-funnel-name {
    font-weight: 600;
    font-size: 15px;
}

.mbo-funnel-count {
    font-weight: 700;
    font-size: 18px;
}

.mbo-funnel-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    font-size: 13px;
    color: #64748b;
}

.mbo-funnel-rate {
    font-weight: 600;
    color: #1e293b;
}

.mbo-funnel-prev {
    font-size: 12px;
    color: #94a3b8;
}

.mbo-funnel-arrow {
    text-align: center;
    color: #cbd5e1;
    font-size: 20px;
    line-height: 1;
}

.mbo-funnel-conversion {
    padding: 16px 20px;
    background: #fff;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.mbo-funnel-conversion p {
    margin: 0;
    font-size: 15px;
    color: #475569;
}

.mbo-funnel-conversion strong {
    font-size: 24px;
    color: #1e293b;
    margin: 0 8px;
}

/* ゼロ件の場合のバースタイル */
.mbo-funnel-bar-zero {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    opacity: 0.6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mbo-funnel-bar-zero:hover {
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* バーとテキストのラッパー（横並び、左詰め） */
.mbo-funnel-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.mbo-funnel-bar-wrapper .mbo-funnel-bar {
    min-height: 50px;
}

/* 外側に表示されるラベル */
.mbo-funnel-label-outside {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
}

.mbo-funnel-label-outside .mbo-funnel-name {
    font-weight: 600;
    font-size: 15px;
    color: #3b82f6;
}

.mbo-funnel-label-outside .mbo-funnel-count {
    font-weight: 700;
    font-size: 18px;
    color: #3b82f6;
}

/* ===== Comparison Table ===== */
.mbo-comparison-section,
.mbo-pageviews-section {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mbo-comparison-table,
.mbo-pageviews-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #fff;
}

.mbo-comparison-table thead,
.mbo-pageviews-table thead {
    background: #f8fafc;
}

.mbo-comparison-table th,
.mbo-pageviews-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.mbo-comparison-table td,
.mbo-pageviews-table td {
    padding: 16px;
    font-size: 14px;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}

.mbo-comparison-table tr:last-child td,
.mbo-pageviews-table tr:last-child td {
    border-bottom: none;
}

.mbo-comparison-table tr:hover,
.mbo-pageviews-table tr:hover {
    background: #f8fafc;
}

.mbo-comparison-table td:last-child,
.mbo-pageviews-table td:last-child {
    font-weight: 600;
}

.mbo-comparison-table strong,
.mbo-pageviews-table strong {
    color: #1e293b;
}

/* ===== Bookings Summary Cards ===== */
.mbo-bookings-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.mbo-summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mbo-summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.mbo-summary-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    color: #fff;
    font-size: 28px;
    flex-shrink: 0;
}

.mbo-summary-content {
    flex: 1;
    min-width: 0;
}

.mbo-summary-value {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.mbo-summary-label {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    margin: 0;
}

.mbo-summary-detail {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ===== Data Table ===== */
.mbo-table-section {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.mbo-data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: #fff;
}

.mbo-data-table thead {
    background: #f8fafc;
}

.mbo-data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.mbo-data-table td {
    padding: 16px;
    font-size: 14px;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}

.mbo-data-table tr:last-child td {
    border-bottom: none;
}

.mbo-data-table tr:hover {
    background: #f8fafc;
}

.mbo-data-table strong {
    color: #1e293b;
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
    .mbo-stats-grid {
        grid-template-columns: 1fr;
    }

    .mbo-chart-container {
        height: 300px;
    }

    .mbo-funnel-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .mbo-funnel-info {
        flex-wrap: wrap;
        padding: 0 12px;
    }

    .mbo-comparison-table,
    .mbo-pageviews-table {
        font-size: 12px;
    }

    .mbo-comparison-table th,
    .mbo-comparison-table td,
    .mbo-pageviews-table th,
    .mbo-pageviews-table td {
        padding: 12px 8px;
    }

    .mbo-bookings-summary {
        grid-template-columns: 1fr;
    }

    .mbo-summary-card {
        padding: 20px;
    }

    .mbo-summary-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .mbo-summary-value {
        font-size: 28px;
    }

    .mbo-data-table {
        font-size: 12px;
    }

    .mbo-data-table th,
    .mbo-data-table td {
        padding: 12px 8px;
    }
}
