/* 顧客分析ウィジェット */
.salon-customer-analytics-widget {
    max-width: 100%;
    margin: 10px 0;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* スクロール機能対応 */
    max-height: 100vh;
    overflow-y: auto;
    scroll-behavior: smooth;
    
    /* メニューバーとの重複防止 */
    padding-bottom: 160px;
    
    /* カスタムスクロールバー */
    scrollbar-width: thin;
    scrollbar-color: #3498db #f1f1f1;
}

/* Webkit系ブラウザ用カスタムスクロールバー */
.salon-customer-analytics-widget::-webkit-scrollbar {
    width: 8px;
}

.salon-customer-analytics-widget::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.salon-customer-analytics-widget::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.salon-customer-analytics-widget::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* ヘッダー - 通常表示 */
.salon-customer-analytics-header {
    margin-bottom: 15px;
    padding: 15px 0;
    border-bottom: 2px solid #f0f0f0;
    transition: all 0.3s ease;
}

/* コンパクトモード不使用のため削除 */

.salon-customer-analytics-title {
    margin: 0 0 15px 0;
    padding: 5px 0;
    font-size: 1.6em;
    color: #2c3e50;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}

/* コントロール */
.salon-customer-analytics-controls {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.date-selector {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.year-select,
.month-select {
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    min-width: 130px;
    transition: border-color 0.3s ease;
}

.year-select:focus,
.month-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.salon-update-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.salon-update-btn:hover {
    background: linear-gradient(135deg, #2980b9, #1f639a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.salon-update-btn:active {
    transform: translateY(0);
}

/* 概要カード */
.customer-overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.overview-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid #dee2e6;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.overview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.card-icon {
    font-size: 2.5em;
    opacity: 0.8;
}

.card-content h4 {
    margin: 0 0 5px 0;
    font-size: 0.9em;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 2em;
    font-weight: 700;
    color: #2c3e50;
    margin-right: 5px;
}

.card-unit {
    font-size: 0.9em;
    color: #6c757d;
    font-weight: 500;
}

/* チャートグリッド */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.chart-section {
    background: #fafafa;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.chart-section.full-width {
    grid-column: 1 / -1;
}

.chart-title {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    color: #2c3e50;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-container {
    position: relative;
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #e9ecef;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.legend-color.new-color {
    background-color: #FF6B6B;
}

.legend-color.repeat-color {
    background-color: #4ECDC4;
}

.chart-description {
    margin-top: 10px;
    text-align: center;
}

.chart-description p {
    margin: 0;
    font-size: 0.85em;
    color: #6c757d;
    font-style: italic;
}

/* ローディング */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    z-index: 10;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.spinner-icon {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* エラーメッセージ */
.error-message {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border: 1px solid #f8bbd9;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    color: #c62828;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-icon {
    font-size: 1.5em;
}

.error-text {
    margin: 0;
    font-weight: 500;
    flex: 1;
}

/* データなしメッセージ */
.no-data-message {
    text-align: center;
    padding: 50px 20px;
    color: #6c757d;
}

.no-data-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.6;
}

.no-data-message h4 {
    margin: 0 0 10px 0;
    font-size: 1.3em;
    color: #495057;
}

.no-data-message p {
    margin: 0;
    font-size: 1em;
    line-height: 1.5;
}

/* サマリー */
.customer-summary-container {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    border-left: 4px solid #3498db;
}

.summary-title {
    margin: 0 0 20px 0;
    font-size: 1.3em;
    color: #2c3e50;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.summary-label {
    font-weight: 500;
    color: #495057;
}

.summary-value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1em;
}

/* 分析仕様説明 */
.analysis-specification {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
    border-radius: 10px;
    border-left: 4px solid #4caf50;
    border: 1px solid #c8e6c9;
}

.spec-title {
    margin: 0 0 20px 0;
    font-size: 1.2em;
    color: #2e7d32;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spec-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.spec-item {
    background: rgba(255, 255, 255, 0.7);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.spec-item h5 {
    margin: 0 0 10px 0;
    font-size: 1em;
    color: #2e7d32;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.spec-item p {
    margin: 0;
    font-size: 0.9em;
    color: #4a4a4a;
    line-height: 1.5;
}

.spec-item strong {
    color: #2e7d32;
    font-weight: 600;
}

/* PDF保存セクション */
.pdf-section {
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, #e3f2fd, #f0f8ff);
    border-radius: 8px;
    border-left: 4px solid #2196f3;
    text-align: center;
}

.pdf-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pdf-generate-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(33, 150, 243, 0.3);
    min-width: 160px;
}

.pdf-generate-btn:hover {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
}

.pdf-generate-btn:active {
    transform: translateY(0);
}

.pdf-generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pdf-status {
    font-size: 12px;
    color: #666;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdf-status.loading {
    color: #2196f3;
}

.pdf-status.success {
    color: #4caf50;
    font-weight: 600;
}

.pdf-status.error {
    color: #f44336;
    font-weight: 600;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .salon-customer-analytics-widget {
        padding: 15px;
        margin: 15px 0;
        /* スマホでの下部余白を増加 */
        padding-bottom: 180px;
        /* 高さ制限を調整 */
        max-height: calc(100vh - 20px);
    }
    
    .salon-customer-analytics-title {
        font-size: 1.4em;
        padding: 8px 0;
        line-height: 1.3;
    }
    
    .date-selector {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .year-select,
    .month-select,
    .salon-update-btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .customer-overview-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .overview-card {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .card-content {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .salon-customer-analytics-widget {
        padding: 12px;
        /* 小さいスマホでの下部余白をさらに増加 */
        padding-bottom: 200px;
        /* 高さ制限をさらに調整 */
        max-height: calc(100vh - 10px);
    }
    
    .salon-customer-analytics-title {
        font-size: 1.3em;
        padding: 10px 0;
        line-height: 1.4;
    }
    
    .chart-container {
        padding: 10px;
    }
    
    .overview-card {
        padding: 15px;
    }
    
    .chart-section {
        padding: 15px;
    }
    
    .legend-item {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

/* 特別な色調整 */
.overview-card:nth-child(1) {
    border-left: 4px solid #FF6B6B;
}

.overview-card:nth-child(2) {
    border-left: 4px solid #4ECDC4;
}

.overview-card:nth-child(3) {
    border-left: 4px solid #45B7D1;
}

.overview-card:nth-child(4) {
    border-left: 4px solid #96CEB4;
}

/* スクロールナビゲーション - 削除 */

/* セクション識別用 - 不使用 */

/* スクロールボタン */
.scroll-to-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

.scroll-to-top.visible {
    display: flex;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}