/* Analytics Widgets Styles */

.analytics-widgets {
    display: none;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    padding-top: 70px;
    max-width: 1400px;
    margin: 0 auto;
}

.analytics-widgets.visible {
    display: flex;
}

.analytics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

@media (hover: none) and (pointer: coarse) {
    .analytics-widgets {
        padding-top: 90px;
    }
}

.analytics-widget {
    background: linear-gradient(145deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
}

.analytics-refresh-btn {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    transition: all 0.2s;
}

.analytics-refresh-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #4285f4;
}

.analytics-widget-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.analytics-widget-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4285f4, #34a853);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.analytics-widget-icon.traffic {
    background: linear-gradient(135deg, #ea4335, #fbbc05);
}

.analytics-widget-icon.pages {
    background: linear-gradient(135deg, #34a853, #4285f4);
}

.analytics-widget-title-link {
    text-decoration: none;
    color: inherit;
}

.analytics-widget-title-link:hover .analytics-widget-title {
    color: #4285f4;
}

.analytics-widget-title {
    font-size: 1.2rem;
    font-weight: 500;
    margin: 0;
    transition: color 0.2s;
}

.analytics-widget-subtitle {
    font-size: 0.8rem;
    opacity: 0.6;
    margin: 0;
}

.analytics-widget-content {
    min-height: 80px;
}

/* Stats grid */
.analytics-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    text-align: center;
}

.analytics-stat {
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}

.analytics-stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4285f4;
}

.analytics-stat-label {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 4px;
}

/* Traffic list */
.analytics-traffic-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
}

.analytics-traffic-item {
    padding: 8px 0;
}

.analytics-traffic-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.analytics-traffic-source {
    font-size: 0.9rem;
}

.analytics-traffic-sessions {
    font-size: 0.9rem;
    opacity: 0.8;
}

.analytics-traffic-bar {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.analytics-traffic-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4285f4, #34a853);
    border-radius: 2px;
    transition: width 0.3s;
}

/* Pages list */
.analytics-pages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.analytics-page-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    transition: all 0.2s;
}

.analytics-page-item:hover {
    background: rgba(255,255,255,0.1);
}

.analytics-page-path {
    font-size: 0.85rem;
    font-family: monospace;
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

.analytics-page-views {
    font-size: 0.85rem;
    font-weight: 500;
    color: #4285f4;
}

/* States */
.analytics-loading {
    text-align: center;
    padding: 20px;
    opacity: 0.6;
}

.analytics-error {
    text-align: center;
    padding: 15px;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 10px;
}

.analytics-empty {
    text-align: center;
    padding: 20px;
    opacity: 0.5;
}

/* Scrollbar styling */
.analytics-traffic-list::-webkit-scrollbar,
.analytics-pages-list::-webkit-scrollbar {
    width: 6px;
}

.analytics-traffic-list::-webkit-scrollbar-track,
.analytics-pages-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.analytics-traffic-list::-webkit-scrollbar-thumb,
.analytics-pages-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

/* Collapsible Sections */
.analytics-section {
    margin-bottom: 10px;
}

.analytics-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(145deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.03) 100%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: all 0.2s;
}

.analytics-section-header::-webkit-details-marker {
    display: none;
}

.analytics-section-header::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid rgba(255,255,255,0.5);
    transition: transform 0.2s;
}

.analytics-section[open] .analytics-section-header::before {
    transform: rotate(180deg);
}

.analytics-section-header:hover {
    background: linear-gradient(145deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.06) 100%);
}

.analytics-section-header svg {
    opacity: 0.7;
}

.analytics-section > .analytics-row {
    margin-top: 15px;
}

/* Realtime Widget */
.analytics-widget-icon.realtime {
    background: linear-gradient(135deg, #00c853, #69f0ae);
}

.analytics-realtime-display {
    text-align: center;
    padding: 20px;
}

.analytics-realtime-display.pulse .analytics-realtime-count {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.analytics-realtime-count {
    font-size: 3rem;
    font-weight: 700;
    color: #00c853;
    line-height: 1;
}

.analytics-realtime-label {
    font-size: 0.85rem;
    opacity: 0.6;
    margin-top: 8px;
}

/* Engagement Widget */
.analytics-widget-icon.engagement {
    background: linear-gradient(135deg, #ff6f00, #ffab00);
}

/* Events Widget */
.analytics-widget-icon.events {
    background: linear-gradient(135deg, #aa00ff, #e040fb);
}

/* Devices Widget */
.analytics-widget-icon.devices {
    background: linear-gradient(135deg, #00b0ff, #40c4ff);
}

.analytics-devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 15px;
    text-align: center;
}

.analytics-device-item {
    padding: 15px 10px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    transition: all 0.2s;
}

.analytics-device-item:hover {
    background: rgba(255,255,255,0.1);
}

.analytics-device-icon {
    margin-bottom: 8px;
    opacity: 0.7;
}

.analytics-device-icon svg {
    fill: currentColor;
}

.analytics-device-name {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: capitalize;
}

.analytics-device-percent {
    font-size: 1.5rem;
    font-weight: 600;
    color: #00b0ff;
    margin: 5px 0;
}

.analytics-device-count {
    font-size: 0.7rem;
    opacity: 0.5;
}

/* Geo Widget */
.analytics-widget-icon.geo {
    background: linear-gradient(135deg, #00bfa5, #1de9b6);
}

.analytics-traffic-bar-fill.geo {
    background: linear-gradient(90deg, #00bfa5, #1de9b6);
}

/* Landing/Exit Pages Widget */
.analytics-widget-icon.landing {
    background: linear-gradient(135deg, #ff5252, #ff8a80);
}

.analytics-landing-exit {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.analytics-le-section {
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
}

.analytics-le-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.6;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.analytics-le-section .analytics-page-item {
    padding: 6px 8px;
    margin-bottom: 4px;
}

.analytics-le-section .analytics-page-path {
    font-size: 0.75rem;
}

.analytics-le-section .analytics-page-views {
    font-size: 0.75rem;
}

/* Responsive adjustments for sections */
@media (max-width: 768px) {
    .analytics-landing-exit {
        grid-template-columns: 1fr;
    }

    .analytics-devices-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
