/**
 * AI Insight FAB - Floating Action Button Styles
 * Version: 1.0.0
 * 
 * Contents:
 * 1. Debug & Admin Styles
 * 2. URL List & Status Styles
 * 3. JSON Viewer & Overlay Styles
 */

/* ---------------------------------------------- */
/* 1. Debug & Admin Styles                        */
/* ---------------------------------------------- */

/* Debug sections */
.ai-insight-fab-debug-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.ai-insight-fab-debug-section h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Debug log display */
.ai-insight-fab-debug-log {
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    padding: 10px;
    max-height: 500px;
    overflow-y: auto;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.4;
    margin-top: 15px;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

.ai-insight-fab-debug-log pre {
    white-space: pre-wrap;       /* CSS3 */
    white-space: -moz-pre-wrap;  /* Firefox */
    white-space: -pre-wrap;      /* Opera <7 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* IE */
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Log refresh icon */
.ai-insight-fab-refresh-icon {
    cursor: pointer;
    margin-left: 8px;
    color: #72aee6;
    font-size: 18px;
    transition: color 0.2s ease;
    border: none;
    background: none;
    padding: 0;
    line-height: 1;
}

.ai-insight-fab-refresh-icon:hover {
    color: #135e96;
}

.ai-insight-fab-refresh-icon.spinning {
    animation: ai-insight-fab-spin 1s infinite linear;
}

@keyframes ai-insight-fab-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Status messages */
.ai-insight-fab-status-success {
    color: #46b450;
}

.ai-insight-fab-status-error {
    color: #dc3232;
}

/* Make forms look nicer */
.ai-insight-fab-debug-section input[type="url"],
.ai-insight-fab-debug-section input[type="text"] {
    width: 100%;
    max-width: 400px;
}

/* LLM Admin Styles */
.ai-insight-fab-llm-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

/* URL entry styles */
.url-entry {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 2px;
}

.url-number {
    display: inline-block;
    width: 20px;
    font-weight: bold;
    margin-right: 5px;
}

.url-name {
    width: 150px;
    margin-right: 10px;
}

.url-value {
    width: 100%;
    margin-right: 10px;
}

/* URL Container Styling */
#ai-insight-urls-container {
    border: 1px solid #dcdcde;
    background-color: #fff;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 20px;
}

/* Status and View Icons */
.url-status,
.url-json-view {
    width: 22px;
    height: 22px;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    position: relative;
    background-color: transparent;
    border-radius: 0;
    transition: background-color 0.2s ease;
}

.url-json-view {
    color: #0073aa;
    cursor: pointer;
}

.url-json-view:hover {
    background-color: #e0e0e0;
    color: #005177;
}

.url-json-view-disabled {
    cursor: not-allowed;
    color: #ccc;
}

.url-json-view-disabled:hover {
    background-color: #f0f0f0;
    color: #ccc;
}

/* Status Colors */
.url-status-pending { color: #777; }
.url-status-downloading { 
    color: #0073aa;
    animation: pulse 1.5s infinite;
}
.url-status-success { color: #46b450; }
.url-status-error { color: #dc3232; }

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Tooltips */
.url-json-view .tooltip,
.url-status .tooltip {
    visibility: hidden;
    width: 150px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -75px;
    opacity: 0;
    transition: opacity 0.2s;
}

.url-json-view .tooltip::after,
.url-status .tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

.url-json-view:hover .tooltip,
.url-status:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Controls (remove & refresh buttons) */
.remove-url {
    color: #cc0000;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: color 0.2s ease;
}

.remove-url:hover {
    color: #990000;
}

.remove-url:focus {
    outline: none;
    box-shadow: none;
}

/* ---------------------------------------------- */
/* 3. JSON Viewer & Overlay Styles               */
/* ---------------------------------------------- */

/* JSON Overlay */
.json-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.json-overlay-content {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    max-width: 80%;
    max-height: 80%;
    width: 800px;
    overflow: auto;
    position: relative;
    padding: 20px;
}

.json-overlay-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #444;
    transition: color 0.2s ease;
}

.json-overlay-close:hover {
    color: #000;
}

.json-overlay-title {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
    padding-right: 30px;
}

/* JSON Content Display */
.json-data-display {
    background-color: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    padding: 15px;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    max-height: 500px;
    overflow-y: auto;
}

.json-data-display pre {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden !important;
}

/* JSON Footer & Metadata */
.json-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    gap: 20px;
}

.json-metadata {
    flex: 1;
    color: #666;
    font-size: 0.85em;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.json-metadata span {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.json-metadata span:before {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    content: '';
    opacity: 0.6;
    background-size: contain;
    background-repeat: no-repeat;
}

.json-file-date:before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23666" d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 18c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8zm.5-13H11v6l5.2 3.2.8-1.3-4.5-2.7V7z"/></svg>');
}

.json-file-size:before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23666" d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/></svg>');
}

#json-download-btn {
    flex-shrink: 0;
    margin-left: auto;
}

.dashicons {
    width: 36px !important;
    height: 30px !important;
    align-content: center;
    align-items: center;
}

.model-refresh-button {
    padding: 0;
}

.model-selector-wrapper {
    gap: 5px;
}

.model-dropdown {
    height: 34px;
}

.ai-insight-fab-action-buttons {
    display: flex;
    gap: 4px;
}