/**
 * Connect Dev - Frontend Layout Inspector Styles
 * © 2025 Nando Cardoso® - Connect Designers® - INPI: 923067680
 */

/* Container Principal */
.frontend-inspector-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* Botão Toggle - Ícone do Olho */
.inspector-eye-toggle {
    position: fixed;
    z-index: 999998;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-size: 20px;
}

.inspector-eye-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

.inspector-eye-toggle.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 6px 30px rgba(240, 147, 251, 0.6);
}

.inspector-eye-toggle.inspecting {
    animation: pulse 2s infinite;
}

.inspector-eye-toggle.inspecting i {
    animation: blink 3s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Botão Toggle Antigo (mantido para compatibilidade) */
.inspector-toggle {
    position: fixed;
    z-index: 999998;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    min-width: 200px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.inspector-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
}

.inspector-toggle.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 8px 30px rgba(240, 147, 251, 0.4);
}

.inspector-toggle.inspecting {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.6); }
    100% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3); }
}

/* Posicionamento do toggle */
.inspector-eye-toggle.top-right,
.inspector-toggle.top-right {
    top: 20px;
    right: 20px;
}

.inspector-eye-toggle.top-left,
.inspector-toggle.top-left {
    top: 20px;
    left: 20px;
}

.inspector-eye-toggle.bottom-right,
.inspector-toggle.bottom-right {
    bottom: 20px;
    right: 20px;
}

.inspector-eye-toggle.bottom-left,
.inspector-toggle.bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Conteúdo do toggle */
.toggle-icon {
    display: inline-block;
    margin-right: 8px;
    font-size: 16px;
}

.toggle-label {
    display: inline-block;
    vertical-align: top;
}

.toggle-label span {
    display: block;
    font-weight: 600;
    font-size: 13px;
}

.toggle-label small {
    display: block;
    opacity: 0.8;
    font-size: 11px;
    margin-top: 2px;
}

/* Painel Principal */
.inspector-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 420px;
    max-height: 70vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(25px);
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 999997;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.inspector-panel.minimized {
    height: 60px;
    overflow: hidden;
}

.inspector-panel.minimized .panel-body {
    display: none;
}

/* Header do Painel */
.panel-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.panel-version {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-left: 8px;
}

.panel-controls {
    display: flex;
    gap: 8px;
}

.btn-minimize,
.btn-close {
    background: none;
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-minimize:hover,
.btn-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Body do Painel */
.panel-body {
    padding: 16px;
    max-height: calc(85vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Controles */
.inspector-controls {
    margin-bottom: 16px;
}

.control-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.control-group .btn {
    padding: 10px 8px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
    white-space: nowrap;
}

.btn.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn.btn-info {
    background: #17a2b8;
    color: white;
}

.btn.btn-success {
    background: #28a745;
    color: white;
}

.btn.btn-sm {
    padding: 6px 10px;
    font-size: 11px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Filtros */
.inspector-filters {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.inspector-filters h5 {
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 700;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 0;
}

.filter-option input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

/* Stats */
.inspector-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.stat-item {
    text-align: center;
    padding: 4px;
}

.stat-label {
    display: block;
    font-size: 10px;
    color: #6c757d;
    margin-bottom: 2px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #495057;
    line-height: 1;
}

/* Elemento Selecionado */
.selected-element {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    border: 1px solid #dee2e6;
}

.selected-element h5 {
    margin: 0 0 12px 0;
    font-size: 12px;
    font-weight: 700;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.element-details {
    margin-bottom: 12px;
}

.detail-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.detail-row label {
    font-size: 10px;
    font-weight: 700;
    color: #6c757d;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-row input {
    padding: 6px 8px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 10px;
    background: white;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Overlays de Inspeção */
.frontend-inspector-overlay {
    border: 2px solid;
    background: rgba(102, 126, 234, 0.1);
    pointer-events: none;
    position: absolute;
    transition: all 0.2s;
}

.overlay-section {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.overlay-component {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.overlay-field {
    border-color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
}

/* Labels dos Overlays */
.overlay-label {
    position: absolute;
    top: -45px;
    left: 0;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    white-space: normal;
    max-width: 350px;
    min-width: 200px;
    z-index: 1000000;
    backdrop-filter: blur(15px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    line-height: 1.3;
}

.label-title {
    font-weight: 700;
    margin-bottom: 3px;
    font-size: 12px;
    color: #ffffff;
}

.label-config {
    font-size: 10px;
    opacity: 0.85;
    margin-bottom: 2px;
    color: #e0e0e0;
}

.label-table {
    font-size: 9px;
    opacity: 0.75;
    margin-bottom: 1px;
    color: #4fc3f7;
    font-weight: 500;
}

.label-column {
    font-size: 9px;
    opacity: 0.75;
    margin-bottom: 2px;
    color: #81c784;
    font-weight: 500;
}

.label-type {
    font-size: 8px;
    opacity: 0.7;
    text-transform: uppercase;
    color: #ffab91;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Highlight temporário */
.frontend-inspector-highlight {
    outline: 3px solid #ff6b6b !important;
    outline-offset: 2px;
    background: rgba(255, 107, 107, 0.1) !important;
    transition: all 0.2s;
}

/* Notificações */
.inspector-notifications {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000001;
    pointer-events: none;
}

.inspector-notification {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.inspector-notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification-success {
    background: rgba(40, 167, 69, 0.95);
}

.notification-info {
    background: rgba(23, 162, 184, 0.95);
}

.notification-warning {
    background: rgba(255, 193, 7, 0.95);
    color: #212529;
}

.notification-error {
    background: rgba(220, 53, 69, 0.95);
}

/* Responsivo */
@media (max-width: 768px) {
    .inspector-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 60px;
        max-height: 60vh;
    }
    
    .inspector-eye-toggle {
        width: 45px;
        height: 45px;
        font-size: 18px;
        bottom: 15px;
        right: 15px;
    }
    
    .inspector-toggle {
        right: 10px;
        left: auto;
        min-width: 140px;
        padding: 8px 10px;
    }
    
    .toggle-label span {
        font-size: 11px;
    }
    
    .toggle-label small {
        font-size: 9px;
    }
    
    .filter-options {
        grid-template-columns: 1fr;
    }
    
    .control-group {
        grid-template-columns: 1fr;
    }
    
    .inspector-stats {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .detail-row {
        grid-template-columns: 70px 1fr;
        gap: 6px;
    }
    
    .overlay-label {
        max-width: 280px;
        min-width: 150px;
        font-size: 10px;
    }
    
    .label-title {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .inspector-panel {
        right: 5px;
        left: 5px;
        bottom: 50px;
    }
    
    .inspector-eye-toggle {
        width: 40px;
        height: 40px;
        font-size: 16px;
        bottom: 10px;
        right: 10px;
    }
    
    .panel-body {
        padding: 12px;
    }
    
    .inspector-toggle {
        right: 5px;
        min-width: 120px;
        padding: 6px 8px;
    }
    
    .overlay-label {
        max-width: 200px;
        min-width: 120px;
        padding: 6px 8px;
        font-size: 9px;
    }
    
    .detail-row {
        grid-template-columns: 60px 1fr;
    }
    
    .detail-row label {
        font-size: 8px;
    }
    
    .detail-row input {
        font-size: 9px;
        padding: 4px 6px;
    }
}

/* Animações */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.inspector-panel {
    animation: fadeInUp 0.3s ease-out;
}

/* Scrollbar customizada */
.panel-body::-webkit-scrollbar {
    width: 6px;
}

.panel-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.panel-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.panel-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Estados especiais */
.inspector-panel.dragging {
    transition: none;
}

.overlay-label.bottom {
    top: auto;
    bottom: -40px;
}

.overlay-label.right {
    left: auto;
    right: 0;
}

/* Tooltip de informações rápidas */
.inspector-quick-info {
    animation: fadeInQuick 0.2s ease-out;
}

@keyframes fadeInQuick {
    from { 
        opacity: 0; 
        transform: translateY(-10px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

/* Melhorias no ícone do olho */
.inspector-eye-toggle:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.inspector-eye-toggle:hover:after {
    opacity: 1;
}

/* Modo escuro (opcional) */
@media (prefers-color-scheme: dark) {
    .inspector-panel {
        background: rgba(45, 45, 45, 0.95);
        color: #e9ecef;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .inspector-filters,
    .selected-element,
    .inspector-stats {
        background: rgba(33, 37, 41, 0.7);
    }
    
    .detail-row input {
        background: rgba(33, 37, 41, 0.8);
        border-color: rgba(255, 255, 255, 0.2);
        color: #e9ecef;
    }
}