/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 2rem;
    color: #667eea;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.refresh-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
}

.refresh-indicator i {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.date-range select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Section Headers */
section h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

section h2 i {
    color: #ffd700;
}

/* KPI Section */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.kpi-content h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.25rem;
}

.kpi-change {
    font-size: 0.85rem;
    font-weight: 600;
}

.kpi-change.positive {
    color: #10b981;
}

.kpi-change.negative {
    color: #ef4444;
}

/* Flow Section */
.flow-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
}

.flow-chart {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.flow-metrics {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.flow-step {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.step-content h4 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.step-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
}

.step-rate {
    font-size: 0.85rem;
    color: #10b981;
    font-weight: 600;
}

.flow-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #667eea;
    font-size: 1.2rem;
    font-weight: 600;
}

.flow-arrow i {
    font-size: 1.5rem;
}

/* Campaign Section */
.campaign-container {
    display: grid;
    grid-template-columns: 1fr 500px;
    gap: 2rem;
}

.campaign-chart {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.campaign-table {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    overflow: auto;
}

.campaign-table table {
    width: 100%;
    border-collapse: collapse;
}

.campaign-table th,
.campaign-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.campaign-table th {
    font-weight: 600;
    color: #333;
    background: #f8f9fa;
}

.loading {
    text-align: center !important;
    color: #666;
    font-style: italic;
}

/* Real-time Section */
.realtime-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

.realtime-chart {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.alert-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.alert-panel h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #333;
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
}

.alert-item.normal {
    background: #f0f9ff;
    color: #0891b2;
}

.alert-item.warning {
    background: #fffbeb;
    color: #d97706;
}

.alert-item.critical {
    background: #fef2f2;
    color: #dc2626;
}

.alert-item time {
    margin-left: auto;
    font-size: 0.75rem;
    color: #666;
}

/* Attribution Section */
.attribution-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
}

.attribution-chart {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.attribution-details {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.attribution-details h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 1.5rem;
}

.attribution-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.attribution-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.source-name {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.source-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #667eea;
    margin: 0 1rem;
}

.source-percent {
    font-size: 0.9rem;
    color: #666;
    min-width: 50px;
    text-align: right;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    margin-top: 4rem;
    padding: 2rem 0;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #666;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #764ba2;
}

/* Responsive */
@media (max-width: 1200px) {
    .flow-container,
    .campaign-container,
    .realtime-container,
    .attribution-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Campaign Analysis Enhancements */
.campaign-row td {
    padding: 12px 8px !important;
    line-height: 1.4;
}

.campaign-row small {
    font-size: 0.75rem;
    opacity: 0.8;
}

.high-roi {
    color: #28a745 !important;
    font-weight: bold;
}

.medium-roi {
    color: #ffc107 !important;
    font-weight: bold;
}

.low-roi {
    color: #dc3545 !important;
    font-weight: bold;
}

.open-rate, .click-rate {
    font-weight: 600;
}

/* Campaign Insights */
.insights-container {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.insight-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    border-left: 4px solid;
}

.insight-card.success {
    border-left-color: #28a745;
}

.insight-card.warning {
    border-left-color: #ffc107;
}

.insight-card.info {
    border-left-color: #17a2b8;
}

.insight-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.insight-message {
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.insight-action {
    font-size: 0.85rem;
    opacity: 0.8;
    font-style: italic;
}

/* FTD Matching Section */
.ftd-matching-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.ftd-matching-section h2 {
    margin-bottom: 1.5rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ftd-matching-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* FTD Controls */
.ftd-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.ftd-controls .btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.ftd-controls .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #555;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.ftd-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.status-ready {
    color: #28a745;
}

.status-processing {
    color: #ffc107;
    animation: pulse 1.5s infinite;
}

.status-error {
    color: #dc3545;
}

/* FTD Summary Stats */
.ftd-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.ftd-stat-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.ftd-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.ftd-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.ftd-stat-content h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.25rem;
}

.ftd-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

/* FTD Results Table */
.ftd-results {
    margin-top: 1rem;
}

.ftd-results h3 {
    margin-bottom: 1rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.ftd-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.95);
}

.ftd-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.ftd-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ftd-table tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.ftd-table .ftd-count {
    font-weight: 600;
    color: #667eea;
}

.ftd-table .ftd-amount {
    font-weight: 600;
    color: #28a745;
}

.ftd-table .conversion-rate {
    font-weight: 600;
}

.ftd-table .roi.positive {
    color: #28a745;
    font-weight: 600;
}

.ftd-table .roi.negative {
    color: #dc3545;
    font-weight: 600;
}

.ftd-table .loading {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* FTD Insights */
.ftd-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.ftd-insights .insight-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.ftd-insights .insight-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Responsive Design for FTD Section */
@media (max-width: 768px) {
    .ftd-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .ftd-summary {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .ftd-stat-card {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .ftd-stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .ftd-stat-value {
        font-size: 1.5rem;
    }
    
    .ftd-insights {
        grid-template-columns: 1fr;
    }
}

/* Animation for processing state */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* SendGrid Diagnostics Panel */
.diagnostics-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.diagnostics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.diagnostics-header h3 {
    margin: 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.diagnostics-timestamp {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

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

.diagnostic-item {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.diagnostic-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.diagnostic-item.success {
    border-left-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.diagnostic-item.error {
    border-left-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.diagnostic-item.warning {
    border-left-color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

.diagnostic-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.diagnostic-value {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.diagnostic-item.success .diagnostic-value {
    color: #28a745;
}

.diagnostic-item.error .diagnostic-value {
    color: #dc3545;
}

.diagnostic-item.warning .diagnostic-value {
    color: #e68900;
}

.diagnostic-detail {
    font-size: 0.8rem;
    color: #666;
    opacity: 0.9;
}

.diagnostics-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.diagnostics-actions .btn {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 1px solid rgba(102, 126, 234, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.diagnostics-actions .btn:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

.diagnostics-actions .btn.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.diagnostics-actions .btn.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Diagnostics Modal */
.diagnostics-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.modal-header h3 {
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow: auto;
}

.modal-body pre {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Responsive design for diagnostics */
@media (max-width: 768px) {
    .diagnostics-grid {
        grid-template-columns: 1fr;
    }
    
    .diagnostics-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .diagnostics-actions .btn {
        justify-content: center;
    }
    
    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
}

/* Customer Journey Analysis Styles */
.customer-journey-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 2rem 0;
    margin: 2rem 0;
}

.journey-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Journey Map Styles */
.journey-map-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.journey-stages {
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow-x: auto;
    padding: 1rem 0;
    min-height: 200px;
}

.journey-stage {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 1.5rem;
    color: white;
    min-width: 180px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.journey-stage:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.journey-stage[data-stage="awareness"] {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 100%);
}

.journey-stage[data-stage="interest"] {
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 100%);
}

.journey-stage[data-stage="consideration"] {
    background: linear-gradient(135deg, #45B7D1 0%, #96C93D 100%);
}

.journey-stage[data-stage="purchase"] {
    background: linear-gradient(135deg, #96CEB4 0%, #FFECD2 100%);
    color: #333;
}

.journey-stage[data-stage="retention"] {
    background: linear-gradient(135deg, #FECA57 0%, #FF9FF3 100%);
}

.stage-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.stage-content h4 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.stage-metric {
    margin-bottom: 0.5rem;
}

.metric-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.stage-conversion {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.9;
}

.journey-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    color: #667eea;
}

.conversion-rate {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    white-space: nowrap;
}

/* Funnel Analysis Styles */
.funnel-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.funnel-chart {
    height: 300px;
    margin-bottom: 1.5rem;
}

.funnel-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.insight-metric {
    text-align: center;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.metric-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.insight-metric .metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
}

.metric-description {
    font-size: 0.85rem;
    color: #666;
}

/* Touchpoint Analysis Styles */
.touchpoint-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.touchpoint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.touchpoint-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.touchpoint-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.touchpoint-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.touchpoint-header i {
    font-size: 1.5rem;
    color: #667eea;
}

.touchpoint-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.touchpoint-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.touchpoint-metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.touchpoint-metric .metric-label {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.touchpoint-metric .metric-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}

/* Cross-Channel Analysis Styles */
.cross-channel-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.cross-channel-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.channel-matrix {
    height: 300px;
}

.channel-insights h4 {
    margin-bottom: 1.5rem;
    color: #333;
}

.insight-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.insight-item {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #4ECDC4;
}

.insight-title {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.insight-item .insight-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

/* LTV Analysis Styles */
.ltv-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.ltv-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.ltv-chart {
    height: 300px;
}

.ltv-metrics {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ltv-metric-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
}

.ltv-metric-card h4 {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ltv-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ltv-change {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Responsive Design for Customer Journey */
@media (max-width: 1200px) {
    .journey-stages {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .cross-channel-content,
    .ltv-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .journey-stages {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .journey-arrow {
        transform: rotate(90deg);
    }
    
    .touchpoint-grid {
        grid-template-columns: 1fr;
    }
    
    .touchpoint-metrics {
        grid-template-columns: 1fr;
    }
    
    .funnel-insights {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .journey-container {
        padding: 0 0.5rem;
    }
    
    .journey-map-container,
    .funnel-container,
    .touchpoint-container,
    .cross-channel-container,
    .ltv-container {
        padding: 1rem;
    }
    
    .journey-stage {
        min-width: 160px;
        padding: 1rem;
    }
}

/* FTD Retention Analysis Styles */
.ftd-retention-section {
    background: linear-gradient(135deg, #f1f3f4 0%, #e8eaf6 100%);
    padding: 2rem 0;
    margin: 2rem 0;
}

.ftd-retention-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.retention-summary {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.day-retention-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.day-retention-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-top: 4px solid #667eea;
}

.day-retention-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.day-retention-card h4 {
    margin: 0 0 1rem 0;
    color: #333;
    text-align: center;
}

.retention-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.retention-metric:last-child {
    border-bottom: none;
}

.retention-metric .metric-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.retention-metric .metric-value {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
}

.retention-chart-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: 400px;
}

/* Promo Detail Analysis Styles */
.promo-detail-section {
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    padding: 2rem 0;
    margin: 2rem 0;
}

.promo-detail-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1rem;
}

.promo-chart-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: 400px;
}

.promo-detail-table-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

.promo-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.promo-detail-table th,
.promo-detail-table td {
    padding: 1rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: top;
}

.promo-detail-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

.promo-detail-table tbody tr:hover {
    background: #f9f9f9;
}

.promo-segments {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.retention-breakdown {
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Enhanced Email Analysis Styles */
.email-detail-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 2rem 0;
    margin: 2rem 0;
}

.email-detail-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.email-chart-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: 400px;
}

.email-types-analysis {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.email-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.email-type-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid #667eea;
}

.email-type-card h5 {
    margin: 0 0 1rem 0;
    color: #333;
}

.email-insights-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.insight-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid #28a745;
}

.insight-card h5 {
    margin: 0 0 1rem 0;
    color: #333;
}

.insight-card ul {
    margin: 0;
    padding-left: 1.5rem;
}

.insight-card li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.email-analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.email-analysis-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.email-analysis-card h4 {
    margin: 0 0 1rem 0;
    color: #333;
}

.device-stats {
    display: flex;
    gap: 1rem;
}

.device-stat {
    flex: 1;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
}

.device-stat h6 {
    margin: 0 0 0.5rem 0;
    color: #333;
}

.device-stat p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.subject-line-analysis {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.subject-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.subject-metric {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
}

.subject-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.subject-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Responsive Design for Detailed Analysis */
@media (max-width: 1200px) {
    .email-analysis-grid {
        grid-template-columns: 1fr;
    }
    
    .device-stats {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .day-retention-grid {
        grid-template-columns: 1fr;
    }
    
    .email-type-grid {
        grid-template-columns: 1fr;
    }
    
    .subject-insights {
        grid-template-columns: 1fr;
    }
    
    .promo-detail-table-container {
        padding: 1rem;
    }
    
    .promo-detail-table {
        font-size: 0.8rem;
    }
    
    .promo-detail-table th,
    .promo-detail-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .ftd-retention-container,
    .promo-detail-container,
    .email-detail-container {
        padding: 0 0.5rem;
    }
    
    .retention-summary,
    .email-types-analysis,
    .email-insights-container,
    .subject-line-analysis {
        padding: 1rem;
    }
    
    .day-retention-card,
    .email-analysis-card {
        padding: 1rem;
    }
}

/* FTD Acquisition Analysis Styles */
.ftd-acquisition-section {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 2rem 0;
    margin: 2rem 0;
}

.ftd-acquisition-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.acquisition-summary {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.summary-metric {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid #2196F3;
}

.summary-metric .metric-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-metric .metric-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.day-acquisition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.day-acquisition-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-top: 4px solid #2196F3;
}

.day-acquisition-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.day-acquisition-card h4 {
    margin: 0 0 1rem 0;
    color: #333;
    text-align: center;
}

.acquisition-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.acquisition-metric:last-child {
    border-bottom: none;
}

.acquisition-metric .metric-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.acquisition-metric .metric-value {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
}

.acquisition-chart-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: 400px;
}

/* FTD Email Campaigns Styles */
.ftd-email-campaigns-section {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    padding: 2rem 0;
    margin: 2rem 0;
}

.ftd-email-campaigns-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1rem;
}

.email-funnel-chart-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: 400px;
}

.ftd-campaigns-table-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

.ftd-campaigns-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.ftd-campaigns-table th,
.ftd-campaigns-table td {
    padding: 1rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: top;
}

.ftd-campaigns-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ftd-campaigns-table tbody tr:hover {
    background: #f9f9f9;
}

.campaign-day {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

.campaign-segment {
    font-size: 0.8rem;
    color: #888;
    margin-top: 0.25rem;
    font-style: italic;
}

.ftd-rate {
    font-size: 0.9rem;
    color: #28a745;
    font-weight: 600;
}

.bonus-amount {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 500;
}

/* Post-FTD Retention Styles */
.post-ftd-retention-section {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    padding: 2rem 0;
    margin: 2rem 0;
}

.post-ftd-retention-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.post-ftd-summary {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.post-ftd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.post-ftd-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-top: 4px solid #4caf50;
}

.post-ftd-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.post-ftd-card h4 {
    margin: 0 0 1rem 0;
    color: #333;
    text-align: center;
}

.post-ftd-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.post-ftd-metric:last-child {
    border-bottom: none;
}

.post-ftd-metric .metric-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.post-ftd-metric .metric-value {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
}

.post-ftd-chart-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    height: 400px;
}

/* Responsive Design for FTD Analysis */
@media (max-width: 1200px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .day-acquisition-grid,
    .post-ftd-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .ftd-campaigns-table-container {
        padding: 1rem;
    }
    
    .ftd-campaigns-table {
        font-size: 0.8rem;
    }
    
    .ftd-campaigns-table th,
    .ftd-campaigns-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .ftd-acquisition-container,
    .ftd-email-campaigns-container,
    .post-ftd-retention-container {
        padding: 0 0.5rem;
    }
    
    .acquisition-summary,
    .post-ftd-summary {
        padding: 1rem;
    }
    
    .day-acquisition-card,
    .post-ftd-card {
        padding: 1rem;
    }
}/* Gmail 履歴セクション専用CSS */

.beta-badge {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

.gmail-history-section {
    margin-bottom: 3rem;
}

.gmail-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.gmail-stat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.gmail-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

.gmail-stat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.gmail-stat-content h3 {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 0.5rem 0;
    font-weight: 500;
}

.gmail-stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.25rem;
}

.gmail-stat-change {
    font-size: 0.8rem;
    color: #28a745;
}

.gmail-filters {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.gmail-filter-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.gmail-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gmail-filter-group label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.gmail-filter-input {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    min-width: 140px;
    transition: border-color 0.3s ease;
}

.gmail-filter-input:focus {
    outline: none;
    border-color: #667eea;
}

.gmail-table-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.gmail-table-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gmail-table-header h3 {
    margin: 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gmail-table-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.gmail-count {
    font-size: 0.9rem;
    color: #666;
}

.btn-export {
    background: linear-gradient(45px, #28a745, #20c997);
    border: none;
    color: white;
}

.gmail-table-wrapper {
    overflow-x: auto;
}

.gmail-table {
    width: 100%;
    border-collapse: collapse;
}

.gmail-table th {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.gmail-table th:hover {
    background: linear-gradient(45deg, #5a6fd8, #6a42a0);
}

.gmail-table th i.fas.fa-sort {
    margin-left: 0.5rem;
    opacity: 0.7;
}

.gmail-table td {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.gmail-table tr:hover {
    background-color: #f8f9ff;
    cursor: pointer;
}

.gmail-subject {
    font-weight: 600;
    color: #333;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gmail-to {
    color: #666;
    font-size: 0.9rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gmail-date {
    color: #888;
    font-size: 0.9rem;
    white-space: nowrap;
}

.gmail-reply-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gmail-reply-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.gmail-reply-yes {
    background: #d4edda;
    color: #155724;
}

.gmail-reply-no {
    background: #f8d7da;
    color: #721c24;
}

.gmail-promo-badge {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

.gmail-loading {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.gmail-loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.gmail-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid #f0f0f0;
}

.gmail-page-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gmail-page-btn:hover, .gmail-page-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.gmail-page-btn:disabled {
    background: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
}

/* Gmail モーダル */
.gmail-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.gmail-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    max-width: 900px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.gmail-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.gmail-modal-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gmail-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.gmail-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gmail-modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.gmail-loading-modal {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.gmail-loading-modal i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.gmail-email-detail {
    margin-bottom: 1.5rem;
}

.gmail-detail-row {
    display: flex;
    margin-bottom: 0.5rem;
}

.gmail-detail-label {
    font-weight: bold;
    width: 100px;
    color: #666;
    flex-shrink: 0;
}

.gmail-detail-value {
    flex: 1;
    color: #333;
}

.gmail-email-body {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
}

.gmail-replies-section {
    margin-top: 2rem;
    border-top: 1px solid #e0e0e0;
    padding-top: 1rem;
}

.gmail-reply-item {
    background: #f0f7ff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.gmail-reply-header {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
}

.gmail-reply-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.gmail-reply-body {
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    white-space: pre-wrap;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .gmail-filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .gmail-filter-group {
        width: 100%;
    }
    
    .gmail-filter-input {
        min-width: auto;
    }
    
    .gmail-table-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .gmail-table-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .gmail-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .gmail-modal-body {
        max-height: 70vh;
    }
}