/* Modal específico para Estoque - Layout Horizontal */
.estoque-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.estoque-modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.estoque-modal-content {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 95%;
  max-width: 1200px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn 0.3s ease-out;
}

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

.estoque-modal-header {
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  color: white;
  padding: 24px 32px;
  border-radius: 16px 16px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.estoque-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.estoque-modal-header .header-icon {
  font-size: 28px;
}

.estoque-modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.estoque-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.estoque-modal-body {
  padding: 32px;
}

.estoque-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.estoque-form-row {
  display: contents;
}

.estoque-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.estoque-form-group.full-width {
  grid-column: 1 / -1;
}

.estoque-form-group.half-width {
  grid-column: span 1;
}

.estoque-form-label {
  font-weight: 600;
  color: #37474f;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.estoque-form-label.required::after {
  content: '*';
  color: #e53935;
  margin-left: 4px;
}

.estoque-form-input {
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: #fafafa;
}

.estoque-form-input:focus {
  outline: none;
  border-color: #1976d2;
  background: white;
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.estoque-form-input:invalid {
  border-color: #e53935;
}

.estoque-form-input[type="number"] {
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

.estoque-form-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.estoque-form-select {
  cursor: pointer;
}

.estoque-form-select option {
  padding: 8px;
}

/* Campos específicos */
.estoque-form-group.dimensoes .estoque-form-input {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  text-align: center;
}

.estoque-form-group.quantidade .estoque-form-input {
  text-align: center;
  font-weight: 600;
}

/* Informações de cálculo */
.estoque-calculo-info {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #e3f2fd 0%, #fff3cd 100%);
  border: 1px solid #bbdefb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.calculo-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calculo-info-icon {
  font-size: 24px;
  color: #1976d2;
}

.calculo-info-text {
  color: #1976d2;
  font-weight: 600;
}

.calculo-info-right {
  background: #fffbe6;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid #ffeaa7;
  color: #856404;
  font-weight: 600;
  font-size: 16px;
  min-width: 120px;
  text-align: center;
}

/* Footer do modal */
.estoque-modal-footer {
  background: #f5f5f5;
  padding: 24px 32px;
  border-radius: 0 0 16px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  position: sticky;
  bottom: 0;
}

.estoque-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
  justify-content: center;
}

.estoque-btn-secondary {
  background: #757575;
  color: white;
}

.estoque-btn-secondary:hover {
  background: #616161;
  transform: translateY(-1px);
}

.estoque-btn-primary {
  background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.estoque-btn-primary:hover {
  background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(25, 118, 210, 0.4);
}

.estoque-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Responsividade */
@media (max-width: 768px) {
  .estoque-modal-content {
    width: 98%;
    margin: 10px;
    max-height: 95vh;
  }
  
  .estoque-modal-header {
    padding: 20px 24px;
  }
  
  .estoque-modal-header h2 {
    font-size: 20px;
  }
  
  .estoque-modal-body {
    padding: 24px 20px;
  }
  
  .estoque-form {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .estoque-form-group.half-width {
    grid-column: 1 / -1;
  }
  
  .estoque-calculo-info {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  
  .estoque-modal-footer {
    padding: 20px 24px;
    flex-direction: column;
  }
  
  .estoque-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .estoque-modal-header {
    padding: 16px 20px;
  }
  
  .estoque-modal-header h2 {
    font-size: 18px;
  }
  
  .estoque-modal-body {
    padding: 20px 16px;
  }
  
  .estoque-form-input {
    padding: 10px 14px;
    font-size: 16px; /* Evita zoom no iOS */
  }
}

/* Animações de entrada */
.estoque-modal.show .estoque-modal-content {
  animation: modalSlideIn 0.3s ease-out;
}

/* Estados de loading */
.estoque-form-loading {
  opacity: 0.7;
  pointer-events: none;
}

.estoque-form-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #1976d2;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Validação visual */
.estoque-form-input.error {
  border-color: #e53935;
  background: #ffebee;
}

.estoque-form-input.success {
  border-color: #4caf50;
  background: #e8f5e8;
}

.estoque-form-error {
  color: #e53935;
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.estoque-form-success {
  color: #4caf50;
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
