/**
 * CastConductor Analytics Dashboard Styles
 * 
 * @package CastConductor
 * @since 5.8.0
 */

/* ============================================
   Layout & Container
   ============================================ */

.cc-analytics-wrap {
    max-width: 1600px;
    margin-right: 20px;
}

.cc-analytics-wrap h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.cc-analytics-wrap h1 .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
}

/* ============================================
   Plan Badge
   ============================================ */

.cc-plan-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

.cc-badge-free { background: #f0f0f1; color: #50575e; }
.cc-badge-creator { background: #d1ecf1; color: #0c5460; }
.cc-badge-pro { background: #d4edda; color: #155724; }
.cc-badge-business { background: #fff3cd; color: #856404; }
.cc-badge-agency { background: #e2e3ff; color: #383d9a; }
.cc-badge-enterprise { background: #c3e6cb; color: #155724; }

/* ============================================
   Toolbar
   ============================================ */

.cc-analytics-toolbar {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
}

.cc-period-selector {
    display: flex;
    gap: 5px;
}

.cc-period-btn {
    padding: 6px 14px;
    border: 1px solid #c3c4c7;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    transition: all 0.15s ease;
}

.cc-period-btn:hover {
    background: #f0f0f1;
    border-color: #8c8f94;
}

.cc-period-btn.active {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}

.cc-custom-dates {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cc-custom-dates input[type="date"] {
    padding: 4px 8px;
}

.cc-toolbar-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

.cc-toolbar-actions .button {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cc-toolbar-actions .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ============================================
   Summary Cards
   ============================================ */

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

.cc-summary-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    transition: box-shadow 0.15s ease;
}

.cc-summary-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cc-card-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f6fc;
    border-radius: 50%;
}

.cc-card-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #2271b1;
}

.cc-card-value {
    font-size: 28px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.2;
}

.cc-card-label {
    font-size: 13px;
    color: #50575e;
    margin-top: 2px;
}

/* ============================================
   Charts
   ============================================ */

.cc-charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .cc-charts-row {
        grid-template-columns: 1fr;
    }
}

.cc-chart-container {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
}

.cc-chart-container h3 {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.cc-chart-large canvas {
    height: 300px !important;
}

.cc-chart-small canvas {
    height: 250px !important;
}

/* ============================================
   Sections
   ============================================ */

.cc-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.cc-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.cc-section h3 .dashicons {
    color: #2271b1;
}

/* ============================================
   Locked Features
   ============================================ */

.cc-section.cc-locked {
    position: relative;
    background: #f9f9f9;
}

.cc-section.cc-locked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.7) 100%);
    pointer-events: none;
    border-radius: 4px;
}

.cc-lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #dba617;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    margin-left: auto;
}

.cc-lock-badge .dashicons {
    font-size: 12px;
    width: 12px;
    height: 12px;
    color: #fff;
}

.cc-upgrade-prompt {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 30px 20px;
}

.cc-upgrade-prompt p {
    color: #50575e;
    margin-bottom: 15px;
}

/* ============================================
   Tables
   ============================================ */

.cc-content-table-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

#content-table,
#sponsors-table {
    margin: 0;
}

.cc-trend {
    display: inline-flex;
    align-items: center;
}

.cc-trend-up { color: #00a32a; }
.cc-trend-down { color: #d63638; }

/* ============================================
   Geographic Section
   ============================================ */

/* Header with map toggle button */
.cc-geo-map-btn {
    float: right;
    font-size: 12px;
    padding: 2px 10px;
    margin-top: -3px;
}

.cc-geo-map-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    vertical-align: text-top;
}

/* Map container */
.cc-geo-map-container {
    margin-bottom: 20px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    overflow: hidden;
}

.cc-geo-map-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f6f7f7;
    border-bottom: 1px solid #c3c4c7;
}

.cc-geo-map-overlays {
    display: flex;
    gap: 15px;
}

.cc-geo-map-overlays label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    cursor: pointer;
}

.cc-geo-map {
    height: 300px;
    width: 100%;
}

/* Tables grid layout */
.cc-geo-tables-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .cc-geo-tables-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .cc-geo-tables-grid {
        grid-template-columns: 1fr;
    }
}

.cc-geo-table-wrapper {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 15px;
}

.cc-geo-table-wrapper h4 {
    margin: 0 0 12px 0;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cc-geo-table-wrapper h4 .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #50575e;
}

.cc-geo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cc-geo-table th {
    text-align: left;
    font-weight: 500;
    color: #50575e;
    padding: 6px 8px;
    border-bottom: 1px solid #c3c4c7;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cc-geo-table td {
    padding: 8px;
    border-bottom: 1px solid #f0f0f1;
}

.cc-geo-table tr:last-child td {
    border-bottom: none;
}

.cc-geo-table .cc-empty-state {
    text-align: center;
    color: #646970;
    padding: 20px 10px;
}

.cc-country-flag {
    margin-right: 4px;
}

.cc-geo-dma-note {
    font-size: 11px;
    color: #646970;
    font-style: italic;
    margin: 10px 0 0 0;
}

/* Fullscreen Modal */
.cc-geo-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-geo-modal-content {
    width: 90%;
    height: 85%;
    max-width: 1400px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.cc-geo-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #1d2327;
    color: #fff;
}

.cc-geo-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.cc-geo-modal-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    font-size: 20px;
}

.cc-geo-modal-close:hover {
    color: #72aee6;
}

.cc-geo-modal-close .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.cc-geo-modal-toolbar {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    background: #f6f7f7;
    border-bottom: 1px solid #c3c4c7;
}

.cc-geo-modal-toolbar label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.cc-geo-modal-map {
    flex: 1;
    width: 100%;
}

/* ============================================
   Settings Section
   ============================================ */

.cc-settings-section {
    background: #f9f9f9;
}

.cc-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 900px) {
    .cc-settings-grid {
        grid-template-columns: 1fr;
    }
}

.cc-setting-group {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
}

.cc-setting-group h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.cc-setting-group .description {
    color: #646970;
    margin-bottom: 15px;
}

.cc-setting-group .form-table {
    margin: 0 0 15px 0;
}

.cc-setting-group .form-table th {
    padding: 10px 10px 10px 0;
    width: 150px;
    font-weight: 400;
}

.cc-setting-group .form-table td {
    padding: 10px 0;
}

.cc-status-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f1;
}

.cc-status-item:last-of-type {
    border-bottom: none;
    margin-bottom: 15px;
}

.cc-status-label {
    font-weight: 500;
    min-width: 100px;
}

.cc-status-value {
    color: #50575e;
}

/* ============================================
   Loading States
   ============================================ */

.cc-loading {
    color: #646970;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.cc-error {
    color: #d63638;
    text-align: center;
    padding: 20px;
}

/* ============================================
   Animations
   ============================================ */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.cc-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================
   Content Type Filters
   ============================================ */

.cc-content-filters {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: #f6f7f7;
    border-radius: 4px;
}

.cc-filter-label {
    font-weight: 500;
    font-size: 13px;
    color: #50575e;
}

.cc-filter-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cc-filter-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.cc-filter-toggle:hover {
    border-color: #2271b1;
}

.cc-filter-toggle input[type="checkbox"] {
    margin: 0;
}

.cc-filter-hint {
    color: #646970;
    font-size: 12px;
    font-style: italic;
}

/* Content Filters Layout */
.cc-content-filters {
    margin-bottom: 15px;
}

.cc-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.cc-filter-row:last-child {
    margin-bottom: 0;
}

.cc-search-row {
    margin-top: 10px;
}

.cc-search-input {
    flex: 0 0 250px;
    max-width: 250px;
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
}

.cc-search-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.cc-search-clear {
    padding: 3px 8px !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    min-height: 0 !important;
}

/* Search highlight */
.cc-content-table-wrapper mark {
    background: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}

/* ============================================
   Type Badges
   ============================================ */

.cc-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
}

.cc-type-promo, .cc-type-promos { background: #d4edda; color: #155724; }
.cc-type-sponsor, .cc-type-sponsors { background: #fff3cd; color: #856404; }
.cc-type-shoutout, .cc-type-shoutouts { background: #d1ecf1; color: #0c5460; }
.cc-type-track_info_hero { background: #f8d7da; color: #721c24; }
.cc-type-unknown { background: #f0f0f1; color: #50575e; }

/* ============================================
   Tabs
   ============================================ */

.cc-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #c3c4c7;
    margin-bottom: 15px;
}

.cc-tab {
    padding: 10px 20px;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #50575e;
    margin-bottom: -1px;
    transition: all 0.15s ease;
}

.cc-tab:hover {
    color: #2271b1;
}

.cc-tab.cc-tab-active {
    background: #fff;
    border-color: #c3c4c7;
    border-bottom-color: #fff;
    color: #1d2327;
}

.cc-tab-content {
    padding: 10px 0;
}

/* ============================================
   Collection Settings Toggles
   ============================================ */

.cc-collection-toggles {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.cc-collection-toggle {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    background: #f6f7f7;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.cc-collection-toggle:hover {
    background: #f0f0f1;
}

.cc-collection-toggle input[type="checkbox"] {
    margin-top: 2px;
}

.cc-toggle-label {
    font-weight: 500;
    color: #1d2327;
    min-width: 120px;
}

.cc-toggle-desc {
    color: #646970;
    font-size: 12px;
}

/* Content type badges */
.cc-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
}

.cc-type-promo { background: #d4edda; color: #155724; }
.cc-type-sponsor { background: #fff3cd; color: #856404; }
.cc-type-shoutout { background: #e2e3ff; color: #383d9a; }
.cc-type-track_info, .cc-type-track_info_hero { background: #d1ecf1; color: #0c5460; }
.cc-type-weather { background: #cce5ff; color: #004085; }
.cc-type-clock { background: #f8d7da; color: #721c24; }
.cc-type-location { background: #f5f5f5; color: #666; }
.cc-type-custom, .cc-type-unknown { background: #f0f0f1; color: #50575e; }

/* Content filters in Content Performance section */
.cc-content-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.cc-filter-label {
    font-weight: 500;
    color: #1d2327;
}

.cc-filter-toggles {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cc-filter-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f0f0f1;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cc-filter-toggle:hover {
    background: #e5e5e5;
}

.cc-filter-toggle input[type="checkbox"] {
    margin: 0;
}

.cc-filter-hint {
    color: #646970;
    font-style: italic;
    font-size: 12px;
}

/* ============================================
   Map Stat Labels (Infographic Overlays)
   ============================================ */

.cc-map-stat-label {
    background: transparent;
    border: none;
}

.cc-stat-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-100%);
    pointer-events: none;
}

.cc-stat-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
}

.cc-stat-city {
    font-weight: 600;
    font-size: 12px;
}

.cc-stat-count {
    font-size: 14px;
    font-weight: 700;
    color: #72aee6;
}

/* Zoom controls styling within modal */
.cc-geo-modal-map .leaflet-control-zoom {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cc-geo-modal-map .leaflet-control-zoom a {
    background: #1d2327;
    color: #fff;
    border: none;
}

.cc-geo-modal-map .leaflet-control-zoom a:hover {
    background: #2c3338;
}
