/* Preview Popup - Bottom right corner popup with auto-dismiss timer */

.preview-popup {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 340px;
    max-height: 450px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dark .preview-popup {
    background: #1e293b;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Animations */
.preview-popup.hidden {
    display: none;
}

.preview-popup.showing {
    animation: slideIn 0.3s ease-out forwards;
}

.preview-popup.hiding {
    animation: slideOut 0.2s ease-out forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(400px);
    }
}

/* Progress bar */
.preview-popup-progress {
    height: 3px;
    background: #e2e8f0;
    width: 100%;
    flex-shrink: 0;
}

.dark .preview-popup-progress {
    background: #334155;
}

.preview-popup-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ea580c, #fb923c);
    width: 100%;
    border-radius: 0 3px 3px 0;
}

/* Header */
.preview-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.dark .preview-popup-header {
    border-bottom-color: #334155;
}

.preview-popup-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.dark .preview-popup-title {
    color: #94a3b8;
}

.preview-popup-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

.preview-popup-close:hover {
    background: #f1f5f9;
    color: #64748b;
}

.dark .preview-popup-close:hover {
    background: #334155;
    color: #e2e8f0;
}

/* Map container */
.preview-popup-map {
    height: 150px;
    flex-shrink: 0;
    border-bottom: 1px solid #e2e8f0;
}

.dark .preview-popup-map {
    border-bottom-color: #334155;
}

.preview-popup-map.hidden {
    display: none;
}

/* Content area */
.preview-popup-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

/* Common link style */
.preview-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #ea580c;
    font-size: 12px;
    text-decoration: none;
    margin-top: 12px;
}

.preview-link:hover {
    text-decoration: underline;
}

.dark .preview-link {
    color: #fb923c;
}

/* Error state */
.preview-error {
    color: #ef4444;
    font-size: 13px;
    text-align: center;
    padding: 20px;
}

/* Image preview */
.preview-image-container {
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
}

.dark .preview-image-container {
    background: #334155;
}

.preview-image-container img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    display: block;
}

/* YouTube preview */
.preview-youtube {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.preview-youtube img {
    width: 100%;
    display: block;
}

.preview-youtube-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    padding-left: 4px;
}

/* URL preview */
.preview-url-domain {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

.dark .preview-url-domain {
    color: #f1f5f9;
}

.preview-url-full {
    font-size: 12px;
    color: #64748b;
    word-break: break-all;
}

.dark .preview-url-full {
    color: #94a3b8;
}

/* Color preview */
.preview-color {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.preview-color-swatch {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.dark .preview-color-swatch {
    border-color: rgba(255, 255, 255, 0.1);
}

.preview-color-values {
    flex: 1;
}

.preview-color-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 12px;
}

.dark .preview-color-row {
    border-bottom-color: #334155;
}

.preview-color-row .label {
    color: #64748b;
    font-weight: 500;
}

.dark .preview-color-row .label {
    color: #94a3b8;
}

.preview-color-row .value {
    color: #0f172a;
    font-family: 'Monaco', 'Menlo', monospace;
}

.dark .preview-color-row .value {
    color: #f1f5f9;
}

/* Date preview */
.preview-date-relative {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
}

.dark .preview-date-relative {
    color: #f1f5f9;
}

.preview-date-formatted {
    font-size: 13px;
    color: #334155;
    margin-bottom: 8px;
}

.dark .preview-date-formatted {
    color: #cbd5e1;
}

.preview-date-iso {
    font-size: 11px;
    color: #64748b;
    font-family: 'Monaco', 'Menlo', monospace;
}

.preview-date-iso .label {
    color: #94a3b8;
}

.dark .preview-date-iso {
    color: #94a3b8;
}

/* JWT preview */
.preview-jwt-info {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.preview-jwt-badge {
    background: #ea580c;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.preview-jwt-alg {
    background: #e2e8f0;
    color: #475569;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
}

.dark .preview-jwt-alg {
    background: #334155;
    color: #94a3b8;
}

.preview-jwt-expired {
    background: #fef2f2;
    color: #dc2626;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.dark .preview-jwt-expired {
    background: #450a0a;
    color: #f87171;
}

.preview-jwt-section {
    margin-bottom: 12px;
}

.preview-jwt-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 6px;
}

.dark .preview-jwt-section-title {
    color: #94a3b8;
}

.preview-jwt-code {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    font-size: 11px;
    font-family: 'Monaco', 'Menlo', monospace;
    color: #334155;
    overflow-x: auto;
    max-height: 100px;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.dark .preview-jwt-code {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

.preview-jwt-meta {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}

.preview-jwt-meta .label {
    color: #94a3b8;
}

.dark .preview-jwt-meta {
    color: #94a3b8;
}

.preview-jwt-valid {
    background: #dcfce7;
    color: #15803d;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.dark .preview-jwt-valid {
    background: #14532d;
    color: #4ade80;
}

.preview-jwt-time {
    font-size: 12px;
    color: #475569;
    margin-bottom: 12px;
    font-weight: 500;
}

.dark .preview-jwt-time {
    color: #94a3b8;
}

.preview-jwt-warnings {
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 12px;
}

.dark .preview-jwt-warnings {
    background: #422006;
    border-color: #854d0e;
}

.preview-jwt-warning {
    display: block;
    font-size: 11px;
    color: #a16207;
    margin: 2px 0;
}

.dark .preview-jwt-warning {
    color: #fbbf24;
}

.preview-jwt-claims {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.dark .preview-jwt-claims {
    border-top-color: #334155;
}

.preview-jwt-claim {
    font-size: 11px;
    margin: 4px 0;
}

.preview-jwt-claim .label {
    color: #64748b;
    margin-right: 4px;
}

.dark .preview-jwt-claim .label {
    color: #94a3b8;
}

/* Base64 preview */
.preview-base64-meta {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 8px;
}

.dark .preview-base64-meta {
    color: #94a3b8;
}

.preview-base64-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
    font-size: 12px;
    font-family: 'Monaco', 'Menlo', monospace;
    color: #334155;
    max-height: 150px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

.dark .preview-base64-content {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

.preview-base64-binary {
    color: #64748b;
    font-size: 12px;
    font-style: italic;
}

/* Cron preview */
.preview-cron-desc {
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    margin-bottom: 12px;
}

.dark .preview-cron-desc {
    color: #f1f5f9;
}

.preview-cron-breakdown {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
}

.dark .preview-cron-breakdown {
    background: #0f172a;
}

.preview-cron-field {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
}

.preview-cron-field .label {
    color: #64748b;
}

.dark .preview-cron-field .label {
    color: #94a3b8;
}

.preview-cron-field .value {
    font-family: 'Monaco', 'Menlo', monospace;
    color: #ea580c;
}

.dark .preview-cron-field .value {
    color: #fb923c;
}

/* Locale preview */
.preview-locale {
    display: flex;
    gap: 16px;
    align-items: center;
}

.preview-locale-flag {
    font-size: 48px;
    line-height: 1;
}

.preview-locale-lang {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

.dark .preview-locale-lang {
    color: #f1f5f9;
}

.preview-locale-country {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}

.dark .preview-locale-country {
    color: #94a3b8;
}

.preview-locale-code {
    font-size: 11px;
    color: #94a3b8;
    font-family: 'Monaco', 'Menlo', monospace;
    margin-top: 4px;
}

/* Country preview */
.preview-country {
    display: flex;
    gap: 16px;
    align-items: center;
}

.preview-country-flag {
    font-size: 48px;
    line-height: 1;
}

.preview-country-name {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}

.dark .preview-country-name {
    color: #f1f5f9;
}

.preview-country-code {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
}

.dark .preview-country-code {
    color: #94a3b8;
}

/* Coordinates preview */
.preview-coordinates-values {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.dark .preview-coordinates-values {
    background: #0f172a;
}

.preview-coord-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.preview-coord-row .label {
    color: #64748b;
}

.dark .preview-coord-row .label {
    color: #94a3b8;
}

.preview-coord-row .value {
    font-family: 'Monaco', 'Menlo', monospace;
    color: #0f172a;
}

.dark .preview-coord-row .value {
    color: #f1f5f9;
}

.preview-coordinates-links {
    display: flex;
    gap: 16px;
}

/* Footer hint */
.preview-popup-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 11px;
    color: #64748b;
    flex-shrink: 0;
}

.dark .preview-popup-footer {
    border-top-color: #334155;
    background: #0f172a;
    color: #94a3b8;
}

.preview-popup-footer svg {
    opacity: 0.6;
}

/* Previewable value indicator */
.json-previewable {
    cursor: pointer;
    position: relative;
}

.json-previewable::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.15s;
}

.json-previewable:hover::after {
    opacity: 0.3;
}
