// Estilos globais para o Material Dialog
:host ::ng-deep {
  .custom-modal-panel {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .mat-mdc-dialog-container {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
  }
}

// Reset e overlay
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

// Overlay tema escuro
:host-context(.dark-theme) .modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}

.modal-container {
  background: white;
  border-radius: 16px;
  width: 450px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  animation: modalShow 0.3s ease-out;
}

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

// Header
.modal-header {
  position: relative;
  padding: 2rem 2rem 1.5rem;
  text-align: center;
  background: white;

  .header-icon {
    margin-bottom: 1rem;
    
    .info-icon {
      width: 64px;
      height: 64px;
      background: linear-gradient(135deg, #9ca3af, #6b7280);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto;
      
      i {
        color: white;
        font-size: 28px;
      }
    }
  }

  .modal-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
  }

  .modal-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
  }

  .close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #9ca3af;

    &:hover {
      background: #f3f4f6;
      color: #6b7280;
    }

    i {
      font-size: 20px;
    }
  }
}

// Content
.modal-content {
  padding: 0 2rem 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.field-group {
  margin-bottom: 1.25rem;

  &:last-child {
    margin-bottom: 0;
  }
}

// Campo unificado com background sutil
.info-field {
  .field-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
  }

  .field-content {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;

    &:hover {
      background: #f5f5f5;
      border-color: #d1d5db;
    }

    .field-value {
      font-size: 1rem;
      color: #1f2937;
      line-height: 1.4;
      margin: 0;
    }

    // Status badge dentro do field-content
    .status-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.5rem 1rem;
      border-radius: 20px;
      font-size: 0.875rem;
      font-weight: 500;
      margin: -0.25rem -0.5rem;

      .status-icon {
        font-size: 16px;
      }

      &.status-connected {
        background: #dcfce7;
        color: #166534;
        
        .status-icon {
          color: #16a34a;
        }
      }

      &.status-error {
        background: #fef2f2;
        color: #991b1b;
        
        .status-icon {
          color: #dc2626;
        }
      }

      &.status-disconnected {
        background: #f3f4f6;
        color: #4b5563;
        
        .status-icon {
          color: #6b7280;
        }
      }

      &.status-active {
        background: #dcfce7;
        color: #166534;
        
        .status-icon {
          color: #16a34a;
        }
      }

      &.status-inactive {
        background: #fef3c7;
        color: #92400e;
        
        .status-icon {
          color: #f59e0b;
        }
      }
    }
  }
}

// Actions
.modal-actions {
  padding: 1.5rem 2rem 2rem;
  display: flex;
  justify-content: center;
  background: white;

  .btn-close {
    background: #FFC82E;
    color: #000000;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;

    &:hover {
      background: #FFD700;
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(255, 200, 46, 0.3);
    }
  }
}

// Dark theme - seguindo padrão do projeto
:host-context(.dark-theme) {
  .modal-container {
    background: var(--surface);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  }

  .modal-header {
    background: var(--surface);

    .header-icon .info-icon {
      background: linear-gradient(135deg, #FFC82E, #FFD700);
    }

    .modal-title {
      color: var(--text-primary);
    }

    .modal-subtitle {
      color: var(--text-secondary);
    }

    .close-button {
      color: var(--text-secondary);

      &:hover {
        background: var(--hover-bg);
        color: var(--text-primary);
      }
    }
  }

  .modal-content {
    .info-field {
      .field-label {
        color: var(--text-primary);
      }

      .field-content {
        background: var(--hover-bg);
        border-color: var(--border-color);

        &:hover {
          background: rgba(255, 255, 255, 0.05);
        }

        .field-value {
          color: var(--text-primary);
        }

        .status-badge {
          &.status-connected {
            background: rgba(22, 163, 74, 0.2);
            color: #4ade80;
            
            .status-icon {
              color: #4ade80;
            }
          }

          &.status-error {
            background: rgba(220, 38, 38, 0.2);
            color: #f87171;
            
            .status-icon {
              color: #f87171;
            }
          }

          &.status-disconnected {
            background: rgba(107, 114, 128, 0.2);
            color: var(--text-secondary);
            
            .status-icon {
              color: var(--text-secondary);
            }
          }

          &.status-active {
            background: rgba(22, 163, 74, 0.2);
            color: #4ade80;
            
            .status-icon {
              color: #4ade80;
            }
          }

          &.status-inactive {
            background: rgba(217, 119, 6, 0.2);
            color: #fbbf24;
            
            .status-icon {
              color: #fbbf24;
            }
          }
        }
      }
    }
  }

  .modal-actions {
    background: var(--surface);

    .btn-close {
      background: #FFC82E;
      color: #000000;

      &:hover {
        background: #FFD700;
        box-shadow: 0 4px 12px rgba(255, 200, 46, 0.4);
      }
    }
  }
}

// Mobile responsivo
@media (max-width: 768px) {
  .modal-container {
    width: 95vw;
    margin: 1rem;
  }

  .modal-header {
    padding: 1.5rem 1.5rem 1rem;

    .header-icon .info-icon {
      width: 56px;
      height: 56px;

      i {
        font-size: 24px;
      }
    }

    .modal-title {
      font-size: 1.25rem;
    }

    .close-button {
      top: 0.75rem;
      right: 0.75rem;
      width: 36px;
      height: 36px;

      i {
        font-size: 18px;
      }
    }
  }

  .modal-content {
    padding: 0 1.5rem 1rem;
    max-height: 50vh;

    .field-group {
      margin-bottom: 1rem;
    }

    .info-field {
      .field-label {
        font-size: 0.8rem;
        margin-bottom: 0.375rem;
      }

      .field-content {
        padding: 0.625rem 0.75rem;

        .field-value {
          font-size: 0.9rem;
        }

        .status-badge {
          padding: 0.375rem 0.75rem;
          font-size: 0.8rem;
          margin: -0.125rem -0.25rem;

          .status-icon {
            font-size: 14px;
          }
        }
      }
    }
  }

  .modal-actions {
    padding: 1rem 1.5rem 1.5rem;

    .btn-close {
      width: 100%;
      padding: 12px 20px;
    }
  }
}

@media (max-width: 480px) {
  .modal-header {
    padding: 1rem;
  }

  .modal-content {
    padding: 0 1rem 1rem;
  }

  .modal-actions {
    padding: 1rem;
  }
} 