/* AI Analytics Manager - Frontend Styles */

.aam-analytics-dashboard {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    overflow: hidden;
}

/* Last Updated Badge */
.aam-last-updated {
    text-align: right;
    font-size: 12px;
    color: #6b7280;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 20px;
}

/* Overview Cards */
.aam-overview-cards {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px;
    margin-bottom: 30px;
}

.aam-card {
    background: #3b82f6;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.aam-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.aam-card:nth-child(1) {
    background: #2563eb;
}

.aam-card:nth-child(2) {
    background: #7c3aed;
}

.aam-card:nth-child(3) {
    background: #059669;
}

.aam-card:nth-child(4) {
    background: #ea580c;
}

.aam-card-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aam-card-icon svg {
    width: 28px;
    height: 28px;
}

.aam-card-content {
    flex: 1;
    min-width: 0;
}

.aam-card-label {
    font-size: 12px;
    margin-bottom: 3px;
    font-weight: 500;
}

.aam-card-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    word-break: break-word;
}

/* Section */
.aam-section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f9fafb;
    border-radius: 10px;
}

.aam-section-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

/* Traffic Sources Legend */
.aam-traffic-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aam-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    transition: background 0.2s;
}

.aam-legend-item:hover {
    background: #f3f4f6;
}

.aam-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.aam-legend-label {
    flex: 1;
    font-size: 14px;
    color: #374151;
}

.aam-legend-value {
    font-weight: 600;
    color: #111827;
    font-size: 15px;
}

/* Countries List - Clean Single Line Layout */
.aam-countries-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aam-country-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    transition: background 0.2s;
}

.aam-country-item:hover {
    background: #f3f4f6;
}

.aam-country-flag {
    flex-shrink: 0;
}

.aam-country-flag img {
    display: block;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.aam-country-name {
    font-size: 14px;
    font-weight: 400;
    color: #374151;
    min-width: 140px;
    flex-shrink: 0;
}

.aam-country-bar {
    position: relative;
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.aam-country-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.aam-country-percentage {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    min-width: 50px;
    text-align: right;
    flex-shrink: 0;
}

/* Keywords */
.aam-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.aam-keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    transition: all 0.2s;
}

.aam-keyword-tag:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateY(-1px);
}

.aam-keyword-text {
    color: #374151;
    font-weight: 500;
}

.aam-keyword-volume {
    font-size: 11px;
    color: #374151;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Metrics Grid */
.aam-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.aam-metric-item {
    padding: 20px;
    background: white;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.aam-metric-label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
}

.aam-metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

/* Error/Notice Messages */
.aam-error,
.aam-notice {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-size: 14px;
}

.aam-error {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.aam-notice {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .aam-analytics-dashboard {
        padding: 20px;
    }
    
    .aam-overview-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
    
    .aam-section {
        padding: 20px;
    }
    
    .aam-country-name {
        min-width: 120px;
        font-size: 13px;
    }
}

@media screen and (max-width: 480px) {
    .aam-analytics-dashboard {
        padding: 15px;
    }
    
    .aam-overview-cards {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    
    .aam-card {
        padding: 15px;
        min-height: 80px;
    }
    
    .aam-card-icon svg {
        width: 28px;
        height: 28px;
    }
    
    .aam-card-value {
        font-size: 20px;
    }
    
    .aam-card-label {
        font-size: 12px;
    }
    
    .aam-section {
        padding: 15px;
    }
    
    .aam-section-title {
        font-size: 18px;
    }
    
    .aam-traffic-legend {
        gap: 10px;
    }
    
    .aam-legend-item {
        padding: 8px 10px;
    }
    
    .aam-legend-label {
        font-size: 13px;
    }
    
    .aam-legend-value {
        font-size: 14px;
    }
    
    .aam-country-item {
        flex-wrap: wrap;
    }
    
    .aam-country-name {
        min-width: 100px;
        font-size: 13px;
    }
    
    .aam-country-percentage {
        min-width: 45px;
        font-size: 13px;
    }
    
    .aam-metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .aam-metric-value {
        font-size: 20px;
    }
    
    .aam-keyword-tag {
        padding: 6px 10px;
        font-size: 12px;
    }
}
