/**
 * 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;
}

/* Tooltip do modo sutil */
.inspector-element-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 999999;
    max-width: 300px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    animation: fadeIn 0.2s ease-in;
}

.inspector-element-tooltip .tooltip-header {
    font-weight: bold;
    margin-bottom: 5px;
    color: #28a745;
    border-bottom: 1px solid rgba(40, 167, 69, 0.3);
    padding-bottom: 5px;
}

.inspector-element-tooltip .tooltip-row {
    margin: 3px 0;
    opacity: 0.9;
}

.inspector-element-tooltip .tooltip-row strong {
    color: #28a745;
    margin-right: 5px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Botão Toggle - Ícone do Olho */
.inspector-eye-toggle {
    position: fixed;
    z-index: 999998;
    background: #6c757d; /* Cinza neutro por padrão */
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    border: 2px solid rgba(255, 255, 255, 0.1);
    font-size: 18px;
    opacity: 0.7;
}

.inspector-eye-toggle:hover {
    transform: scale(1.05);
    opacity: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.inspector-eye-toggle.active {
    background: #28a745; /* Verde quando ativo - menos chamativo */
    opacity: 0.9;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.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: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(255, 255, 255, 0.9) 50%,
        rgba(245, 245, 255, 0.95) 100%);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border-radius: 20px;
    box-shadow: 
        0 30px 90px rgba(102, 126, 234, 0.15),
        0 15px 35px rgba(102, 126, 234, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    z-index: 999997;
    transition: all 0.4s 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;
    border-radius: 4px;
}

.overlay-section {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    border-style: solid;
    border-width: 2px;
}

.overlay-component {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    border-style: solid;
    border-width: 2px;
}

.overlay-field {
    border-color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
    border-style: dashed;
    border-width: 2px;
}

.overlay-filter {
    border-color: #e91e63;
    background: linear-gradient(45deg, rgba(233, 30, 99, 0.1) 0%, rgba(233, 30, 99, 0.05) 100%);
    border-style: dotted;
    border-width: 3px;
    animation: filterPulse 2s infinite;
}

@keyframes filterPulse {
    0%, 100% { 
        border-color: #e91e63;
        box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.4);
    }
    50% { 
        border-color: #ff6090;
        box-shadow: 0 0 10px 3px rgba(233, 30, 99, 0.2);
    }
}

/* Novos estilos para tipos específicos */
.overlay-button {
    border-color: #4a90e2;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.15) 0%, rgba(74, 144, 226, 0.05) 100%);
    border-width: 2px;
    border-style: solid;
}

.overlay-stat {
    border-color: #9c27b0;
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.2) 0%, rgba(156, 39, 176, 0.05) 100%);
    border-width: 3px;
    border-style: double;
    animation: statGlow 3s ease-in-out infinite;
}

@keyframes statGlow {
    0%, 100% { 
        box-shadow: 0 0 5px rgba(156, 39, 176, 0.3);
    }
    50% { 
        box-shadow: 0 0 20px rgba(156, 39, 176, 0.5);
    }
}

.overlay-input {
    border-color: #ff9800;
    background: rgba(255, 152, 0, 0.08);
    border-style: dashed;
    border-width: 2px;
}

.overlay-table {
    border-color: #00bcd4;
    background: rgba(0, 188, 212, 0.05);
    border-style: solid;
    border-width: 2px;
}

.overlay-link {
    border-color: #8bc34a;
    background: rgba(139, 195, 74, 0.08);
    border-style: dotted;
    border-width: 1px;
}

.overlay-card {
    border-color: #795548;
    background: rgba(121, 85, 72, 0.05);
    border-style: solid;
    border-width: 2px;
    border-radius: 8px;
}

/* Labels dos Overlays */
.overlay-label {
    position: absolute;
    top: -65px;
    left: 0;
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.98) 0%, rgba(40, 40, 40, 0.95) 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 11px;
    white-space: normal;
    max-width: 400px;
    min-width: 250px;
    z-index: 1000000;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(255, 255, 255, 0.1) inset;
    border: 1px solid rgba(255, 255, 255, 0.15);
    line-height: 1.4;
    animation: labelFadeIn 0.3s ease-out;
}

@keyframes labelFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.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;
}

.label-value {
    font-size: 13px;
    color: #64b5f6;
    font-weight: 600;
    margin-bottom: 3px;
}

.label-context {
    font-size: 9px;
    color: #ce93d8;
    opacity: 0.9;
    margin-top: 3px;
    font-style: italic;
}

/* 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;
    }
}