/* ==========================================================================
   TYPO3 Metrics Extension - Floating Widget Styles
   ========================================================================== */

/* Floating Widget Container */
.wrob-metrics-widget {
    position: relative;
    z-index: 9999;
}

/* Floating Button */
.metrics-floating-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #0078e6;
    color: white;
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 120, 230, 0.3);
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    user-select: none;
}

.metrics-floating-button:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 120, 230, 0.4);
}

.metrics-floating-button:active {
    transform: translateY(0);
}

.metrics-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.metrics-label {
    white-space: nowrap;
    font-weight: 500;
}

/* Responsive - hide label on small screens */
@media (max-width: 768px) {
    .metrics-floating-button {
        padding: 12px;
        border-radius: 50%;
        bottom: 20vh;
    }
    
    .metrics-label {
        display: none;
    }
}

/* Overlay */
.metrics-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9998;
}

.metrics-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Sliding Panel */
.metrics-panel {
    position: fixed;
    top: 50%;
    right: -60%;
    width: 50%;
    max-width: 600px;
    min-width: 400px;
    height: 50%;
    max-height: 80vh;
    min-height: 400px;
    background: white;
    border-radius: 12px 0 0 12px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-50%);
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.metrics-panel.active {
    right: 0;
}

/* Panel Header */
.metrics-panel-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.metrics-panel-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #212529;
}

.metrics-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.metrics-close-btn:hover {
    background: #e9ecef;
    color: #495057;
}

/* Panel Content */
.metrics-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.metrics-description {
    margin-bottom: 20px;
}

.metrics-description p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Metrics Sections */
.page-metrics-section,
.news-metrics-section {
    margin-bottom: 24px;
}

.page-metrics-section h5,
.news-metrics-section h5 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

/* Metrics List */
.metrics-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.metric-item:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.metric-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.metric-date {
    font-weight: 600;
    color: #495057;
    font-size: 16px;
}

.metric-action {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-action.action-created {
    background: #d4edda;
    color: #155724;
}

.metric-action.action-modified {
    background: #fff3cd;
    color: #856404;
}

.metric-action.action-deleted {
    background: #f8d7da;
    color: #721c24;
}

.metric-details {
    margin-bottom: 12px;
}

.metric-details small {
    font-size: 14px;
    color: #6c757d;
}

.metric-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.historical-link-new-window {
    background: #28a745;
}

.historical-link-new-window:hover {
    background: #218838;
}

.historical-link {
    display: inline-block;
    padding: 6px 12px;
    background: #0078e6;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.historical-link:hover {
    background: #0056b3;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

/* No Metrics States */
.no-metrics,
.no-access {
    text-align: center;
    padding: 40px 20px;
}

.no-metrics p,
.no-access p {
    margin: 0;
    font-size: 16px;
    color: #6c757d;
}

/* Debug Info */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

.alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .metrics-panel {
        width: 60%;
        min-width: 350px;
    }
}

@media (max-width: 768px) {
    .metrics-panel {
        width: 90%;
        min-width: 300px;
        height: 60%;
        right: -95%;
        border-radius: 12px 12px 0 0;
        top: auto;
        bottom: -70%;
        transform: none;
        transition: bottom 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .metrics-panel.active {
        right: 5%;
        bottom: 5%;
    }
    
    .metrics-panel-content {
        padding: 16px;
    }
    
    .metric-item {
        padding: 12px;
    }
    
    .metric-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .metrics-floating-button {
        bottom: 20vh;
        right: 15px;
        padding: 10px;
    }
    
    .metrics-panel {
        width: 95%;
        right: -100%;
        min-width: 280px;
    }
    
    .metrics-panel.active {
        right: 2.5%;
    }
}

/* Smooth scrollbar for panel content */
.metrics-panel-content::-webkit-scrollbar {
    width: 6px;
}

.metrics-panel-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.metrics-panel-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.metrics-panel-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation for floating button */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(0, 120, 230, 0.3);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0, 120, 230, 0.5);
    }
    100% {
        box-shadow: 0 4px 12px rgba(0, 120, 230, 0.3);
    }
}

.metrics-floating-button.has-changes {
    animation: pulse 2s infinite;
}

/* Focus styles for accessibility */
.metrics-floating-button:focus,
.metrics-close-btn:focus,
.historical-link:focus {
    outline: 2px solid #0078e6;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .wrob-metrics-widget {
        display: none !important;
    }
}