/* Gallery Analytics Dashboard Styles */

/* Dashboard Button */
#galleryAnalyticsBtn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: linear-gradient(135deg, #760505 0%, #a00 100%);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(118, 5, 5, 0.3);
    transition: all 0.3s ease;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

#galleryAnalyticsBtn:hover {
    background: linear-gradient(135deg, #a00 0%, #760505 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(118, 5, 5, 0.4);
}

#galleryAnalyticsBtn:active {
    transform: translateY(0) scale(1);
}

/* Dashboard Modal */
#galleryAnalyticsModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10001;
    overflow-y: auto;
    backdrop-filter: blur(5px);
}

.analytics-modal-content {
    background: white;
    margin: 20px auto;
    padding: 30px;
    max-width: 1000px;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Header */
.analytics-modal-content h2 {
    margin: 0 0 30px 0;
    color: #760505;
    font-family: 'Playfair Display', serif;
    font-size: 2.2em;
    text-align: center;
    border-bottom: 3px solid #760505;
    padding-bottom: 15px;
}

#closeAnalyticsModal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #760505;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#closeAnalyticsModal:hover {
    background: #a00;
    transform: scale(1.1);
}

/* Section Headers */
.analytics-modal-content h3 {
    color: #333;
    font-family: 'Playfair Display', serif;
    font-size: 1.5em;
    margin: 30px 0 20px 0;
    padding-left: 15px;
    border-left: 4px solid #760505;
}

/* Overview Stats Grid */
#overviewStats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

#overviewStats > div {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#overviewStats > div::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #760505, #a00);
}

#overviewStats > div:hover {
    transform: translateY(-5px);
    border-color: #760505;
    box-shadow: 0 10px 25px rgba(118, 5, 5, 0.15);
}

#overviewStats h4 {
    margin: 0 0 15px 0;
    color: #495057;
    font-size: 1.1em;
    font-weight: 600;
}

#overviewStats .stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #760505;
    margin-bottom: 5px;
    font-family: 'Inter', sans-serif;
}

/* Image Stats */
#imageStats {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

#imageStats > div {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #760505 #e9ecef;
}

#imageStats > div::-webkit-scrollbar {
    width: 8px;
}

#imageStats > div::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

#imageStats > div::-webkit-scrollbar-thumb {
    background: #760505;
    border-radius: 4px;
}

#imageStats > div > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    background: white;
    margin-bottom: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

#imageStats > div > div:hover {
    background: #f8f9fa;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#imageStats .image-info {
    flex: 1;
}

#imageStats .image-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

#imageStats .image-id {
    color: #6c757d;
    font-size: 0.9em;
    font-family: monospace;
}

#imageStats .image-stats {
    text-align: right;
    min-width: 120px;
}

#imageStats .click-count {
    font-size: 1.5em;
    font-weight: bold;
    color: #760505;
    margin-bottom: 5px;
}

#imageStats .stat-details {
    color: #6c757d;
    font-size: 0.85em;
    line-height: 1.4;
}

/* Recent Activity */
#recentActivity {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

#recentActivity > div {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #760505 #e9ecef;
}

#recentActivity > div::-webkit-scrollbar {
    width: 8px;
}

#recentActivity > div::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

#recentActivity > div::-webkit-scrollbar-thumb {
    background: #760505;
    border-radius: 4px;
}

#recentActivity > div > div {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    background: white;
    margin-bottom: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

#recentActivity > div > div:hover {
    background: #f8f9fa;
    transform: translateX(3px);
}

#recentActivity .activity-image {
    font-weight: bold;
    color: #333;
    margin-bottom: 3px;
}

#recentActivity .activity-time {
    color: #6c757d;
    font-size: 0.9em;
}

#recentActivity .activity-session {
    color: #6c757d;
    font-size: 0.8em;
    font-family: monospace;
    margin-top: 3px;
}

/* Export Section */
.export-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
    text-align: center;
}

.export-section h3 {
    margin-top: 0;
    text-align: left;
}

.export-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

#exportAnalytics, #exportJSON, .reset-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

#exportAnalytics {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

#exportAnalytics:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

#exportJSON {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
    color: white;
}

#exportJSON:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.3);
}

.reset-btn {
    background: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%);
    color: white;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .analytics-modal-content {
        margin: 10px;
        padding: 20px;
        border-radius: 10px;
    }
    
    .analytics-modal-content h2 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }
    
    #overviewStats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    #overviewStats > div {
        padding: 20px 15px;
    }
    
    #overviewStats .stat-number {
        font-size: 2em;
    }
    
    .export-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    #exportAnalytics, #exportJSON, .reset-btn {
        width: 100%;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    #galleryAnalyticsBtn {
        top: 10px;
        right: 10px;
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .analytics-modal-content {
        margin: 5px;
        padding: 15px;
    }
    
    #overviewStats {
        grid-template-columns: 1fr;
    }
    
    #imageStats > div > div,
    #recentActivity > div > div {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    #imageStats .image-stats {
        text-align: center;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #760505;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error Messages */
.analytics-message {
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
}

.analytics-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.analytics-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.analytics-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.empty-state .empty-icon {
    font-size: 3em;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h4 {
    margin: 0 0 10px 0;
    color: #495057;
}

.empty-state p {
    margin: 0;
    font-size: 0.9em;
}


