/**
 * Frontend Debug Panel - Floating Styles
 * Clean, professional debug interface for troubleshooting
 * Gated by Frontend Debug Settings (debug_frontend)
 * 
 * @package Instant_Alter_Search
 * @version 2.0.0
 */

/* ============================================
   DEBUG PANEL CONTAINER & TOGGLE BUTTON
   ============================================ */

.ao-debug-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border: 2px solid #0c4a6e;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 10000000000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
    transition: all 0.3s ease;
    font-weight: bold;
}

.ao-debug-toggle-btn:hover {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.6);
    transform: scale(1.1);
}

.ao-debug-toggle-btn:active {
    transform: scale(0.95);
}

/* ============================================
   FLOATING DEBUG PANEL
   ============================================ */

.ao-debug-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 420px;
    max-height: 600px;
    background: white;
    border: 2px solid #0ea5e9;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10000000001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.ao-debug-panel.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   PANEL HEADER
   ============================================ */

.ao-debug-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    color: white;
    padding: 12px 16px;
    border-bottom: 2px solid #0891b2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ao-debug-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ao-debug-controls {
    display: flex;
    gap: 8px;
}

.ao-debug-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.ao-debug-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

/* ============================================
   TABS NAVIGATION
   ============================================ */

.ao-debug-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

.ao-debug-tab {
    flex: 1;
    padding: 10px 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.ao-debug-tab:hover {
    color: #0284c7;
    background: #f3f4f6;
}

.ao-debug-tab.active {
    color: #0284c7;
    border-bottom-color: #0284c7;
}

/* ============================================
   TAB CONTENT AREA
   ============================================ */

.ao-debug-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #fafafa;
}

.ao-debug-tab-panel {
    display: none;
}

.ao-debug-tab-panel.active {
    display: block;
}

/* ============================================
   DATA DISPLAY STYLES
   ============================================ */

.ao-debug-section {
    margin-bottom: 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 10px;
}

.ao-debug-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

.ao-debug-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 11px;
}

.ao-debug-row:last-child {
    margin-bottom: 0;
}

.ao-debug-label {
    color: #6b7280;
    font-weight: 500;
}

.ao-debug-value {
    color: #1f2937;
    font-weight: 600;
    font-family: 'Monaco', 'Courier New', monospace;
    word-break: break-word;
    max-width: 180px;
    text-align: right;
}

.ao-debug-value.badge {
    background: #dbeafe;
    color: #0c4a6e;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    display: inline-block;
}

.ao-debug-value.badge.success {
    background: #d1fae5;
    color: #065f46;
}

.ao-debug-value.badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.ao-debug-value.badge.error {
    background: #fee2e2;
    color: #991b1b;
}

/* ============================================
   LIST ITEMS (for search terms, results, etc)
   ============================================ */

.ao-debug-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 11px;
}

.ao-debug-list-item {
    padding: 6px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #4b5563;
}

.ao-debug-list-item:last-child {
    border-bottom: none;
}

.ao-debug-list-item-label {
    font-weight: 600;
    color: #1f2937;
    flex: 1;
    word-break: break-word;
}

.ao-debug-list-item-value {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-left: 8px;
    flex-shrink: 0;
}

/* ============================================
   COPY BUTTON & JSON EXPORT
   ============================================ */

.ao-debug-export-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 4px;
    padding: 10px;
    margin-top: 8px;
}

.ao-debug-export-btn {
    width: 100%;
    padding: 8px;
    background: #0284c7;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 6px;
}

.ao-debug-export-btn:hover {
    background: #0369a1;
}

.ao-debug-export-btn.copied {
    background: #10b981;
}

.ao-debug-json-output {
    background: #1f2937;
    color: #10b981;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 9px;
    padding: 8px;
    border-radius: 3px;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.3;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================
   STATS GRID
   ============================================ */

.ao-debug-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.ao-debug-stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 8px;
    text-align: center;
}

.ao-debug-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #0284c7;
    margin: 0 0 4px 0;
}

.ao-debug-stat-label {
    font-size: 10px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

.ao-debug-content::-webkit-scrollbar {
    width: 6px;
}

.ao-debug-content::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.ao-debug-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.ao-debug-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================
   RESPONSIVE & MOBILE
   ============================================ */

@media (max-width: 768px) {
    .ao-debug-panel {
        width: calc(100vw - 40px);
        max-height: 50vh;
        bottom: 70px;
    }

    .ao-debug-value {
        max-width: 100px;
    }

    .ao-debug-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.ao-debug-toggle-btn:focus,
.ao-debug-btn:focus,
.ao-debug-tab:focus,
.ao-debug-export-btn:focus {
    outline: 2px solid #0284c7;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ao-debug-toggle-btn,
    .ao-debug-panel,
    .ao-debug-btn,
    .ao-debug-tab {
        transition: none;
        animation: none;
    }
}
